Create symlinks
This plugin requires Grunt ~0.4.1
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-symlinks --save-dev
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-symlinks');
In your project's Gruntfile, add a section named symlinks
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
symlinks: {
options: {
'createDir' : true,
'relativeTo' : 'path/to',
'type' : 'file'
},
createLinks: {
files : [{
expand : true,
flatten : true,
src : ['test/fixtures/**/*.js'],
dest : 'tmp/'
}]
},
},
})
Type: Boolean
Default value: False
A boolean indicate if the dir are auto created or not
Type: String
Default value: ''
A path from where the symbolic links are relatives
Type: String
Default value: 'dir|file'
To specifically set the type of symlink to be created, default type will be inferred from the target type. Values can be 'dir', 'file', or 'junction'. see node.js - fs for more info
grunt.initConfig({
symlinks: {
single: {
files: [{
src: ['test/fixtures/single.js'],
dest: 'tmp/'
}],
options: {
createDir: true
}
},
folder: {
files: [{
src : ['test/fixtures/folder_one'],
dest : 'tmp/'
}],
options: {
createDir: true,
type : "dir"
}
},
flatten: {
files: [{
expand : true,
flatten : true,
src : ['test/fixtures/**/*.js'],
dest : 'tmp/'
}],
options: {
createDir: true
}
},
relativeTo : {
files: [{
expand : true,
flatten : true,
src: ['test/fixtures/single.js'],
dest: 'tmp/test'
}],
options: {
createDir: true,
relativeTo : 'tmp/test'
}
}
}
})
Single : create in a single file with all the path Folder : create a link to a folder Flatten : create links flatten
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
1.0 : first version