Snippets
Created by
Mathias Elle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | var themepath = 'path/to/my/css/and/js/';
//var jsfiles = 'js/**/*.js';
var jsFiles = [
themepath + 'js/example.js',
themepath + 'otherFolder/js/example2.js'
];
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
less: {
development: {
options: {
compress: false,
yuicompress: false,
optimization: 9
},
files: {
"path/to/my/css/and/js/styles.dev.css": themepath + "less/styles.less" // destination file and source file
}
},
production: {
options: {
compress: true,
yuicompress: true,
optimization: 9
},
files: {
"path/to/my/css/and/js/styles.min.css": themepath + "less/styles.less" // destination file and source file
}
}
},
watch: {
less: {
files: ['path/to/my/css/and/js/less/**/*.less'],
tasks: ['less'],
options: {
nospawn: true
}
},
js: {
files: ['path/to/my/css/and/js/**/*.js'],
tasks: ['uglify'],
options: {
spawn: false,
livereload: true
}
}
},
uglify: {
development: {
options: {
mangle: true,
compress: {
drop_console: true
},
beautify: true,
report: "min",
wrap: undefined,
/**
* When using wrap this will make all global functions and variables available via the export variable.
*/
exportAll: false,
/**
* Turn on preservation of comments.
* More details on https://github.com/gruntjs/grunt-contrib-uglify
* false | 'all' | 'some'
*/
preserveComments: false,
/**
* This string will be prepended to the beginning of the minified output.
*/
banner: '', //'/*! <%= pkg.name %> - v<%= pkg.version %> - ' + '<%= grunt.template.today("yyyy-mm-dd") %> */'
/**
* This string will be append to the end of the minified output.
*/
footer: ''
},
files: [
{
src: [jsFiles],
dest: 'path/to/my/css/and/js/example.js'
}
]
},
production: {
files: [
{
src: [jsFiles],
dest: 'path/to/my/css/and/js/js/example.min.js'
}
]
}
}
});
grunt.registerTask('default', ['less', 'watch']);
};
|
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.