0.1.3 • Published 8 years ago

grunt-csproj v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

grunt-csproj

sync project assets to .csproj file

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-csproj --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-csproj');

The "csproj" task

Task targets and options may be specified according to the grunt Configuring tasks guide.

Overview

In your project's Gruntfile, add a section named csproj to the data object passed into grunt.initConfig().

grunt.initConfig({
  csproj: {
    options: {
      // Task-specific options go here.
      projectPath: './test/project',
      csporjLocation: 'auto',
      watch: ['Scripts/*.js', 'Content/**/*.css'],
      ignore: []
    }
  },
});

Options

options.projectPath

Type: String Default value: ./

projectPath

options.csporjLocation

Type: String Default value: 'auto'

.csproj file's location, if value is 'auto' it will find first .csproj file in projectPath.

options.watch

Type: Array Default value: []

need watch files(relative from projectPath).

options.ignore

Type: Array Default value: []

ignore some files(relative from projectPath) when append to .csjproj.

Usage Examples

grunt.initConfig({
  csproj: {
    options: {
      projectPath: './test/project',
      csporjLocation: 'auto',
      watch: ['Scripts/*.js', 'Content/**/*.css'],
      ignore: ['Scripts/test-ignored.js']
    }
  },
});

project assets :

Scripts/test.js,

Scripts/test-ignored.js, 

Script/test-notin-csproj.js,

Content/test.css,

Content/test-notin-csproj.css

before task test.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<ItemGroup>
		<Content Include="Content\test.css" />
		<Content Include="Scripts\test.js" />
		<Content Include="Global.asax" />
		<Content Include="Content\test2.css" />
		<Content Include="Scripts\test2.js" />
	</ItemGroup>
</Project>

after task test.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <Content Include="Content\test.css" />
        <Content Include="Scripts\test.js" />
        <Content Include="Global.asax" />
        <Content Include="Scripts\test-notin-csproj.js" />
        <Content Include="Content\test-notin-csproj.css" />
    </ItemGroup>
</Project>

Release History

(Nothing yet)

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago