deg-engine-apply-xml-transform
v2.0.3
Published
This is an engine which can be used in conjunction with [BGTM](https://www.npmjs.com/package/bgtm).
Downloads
4
Readme
Deepend Group - Engine for applying XML transforms from within Gulp.
This is an engine which can be used in conjunction with BGTM.
How to use
Read the how to section for BGTM.
Run:
npm install --save-dev deg-engine-apply-xml-transform
In your gulpfile add the following dependency:
var xmlTransform = require('deg-engine-apply-xml-transform');
Then add the following task.
tm.add('transform', {
runOnBuild: true,
watch: false,
watchSource: [],
liveReload: false,
engine: xmlTransform,
engineOptions: {
transformTargetsFile: './build-scripts/resources/targets/applytransforms.targets',
buildConfiguration: '',
buildToolsVersion: 15.0,
buildVerbosity: 'minimal',
buildMaxCpuCount: 0,
buildPlatform: 'Any CPU',
websiteRoot: ''
}
});
Engine Options
Defaults
{
transformTargetsFile: './build-scripts/resources/targets/applytransforms.targets',
buildConfiguration: '',
buildToolsVersion: 15.0,
buildVerbosity: 'minimal',
buildMaxCpuCount: 0,
buildPlatform: 'Any CPU',
websiteRoot: ''
}
Options
| Option | Mandatory | Description | | ------------ | --------- | ----------- | | transformTargetsFile | Yes | The targets file location (see below code block for the targets file contents). | | buildConfiguration | Yes | The build configuration to perform the transforms for. | | buildToolsVersion | Yes | The build tools version, by default this is set to MS Build 15.0. | | buildVerbosity | Yes | The verbosity for the build output. | | buildMaxCpuCount | Yes | The maximum number of CPU's to use for the build. | | buildPlatform | Yes | The platform for the build. | | websiteRoot | Yes | Please use absolute paths (e.g. __dirname + '\build\Website'). |
Targets File Contents
<Project ToolsVersion="14.0" DefaultTargets="ApplyTransform" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(MSBuildToolsVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="ApplyTransform">
<ItemGroup>
<Transform Include="$(TransformFile)" />
<ConfigsToTransform Include="$(FileToTransform)" Condition="Exists(@(Transform))">
<TransformPath>%(Transform.Identity)</TransformPath>
</ConfigsToTransform>
</ItemGroup>
<Message Text="@(ConfigsToTransform)"></Message>
<Message Text="@(Transform)"></Message>
<TransformXml Source="$(WebConfigToTransform)\%(ConfigsToTransform.Identity)"
Transform="%(ConfigsToTransform.TransformPath)"
Destination="$(WebConfigToTransform)\%(ConfigsToTransform.Identity)"
Condition="Exists(@(Transform))"/>
</Target>
</Project>
License
MIT
Copyright 2017 Deepend Sydney Pty Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.