Skip to content

Instantly share code, notes, and snippets.

@ancillaryfactory
Created March 17, 2014 02:31
Show Gist options
  • Save ancillaryfactory/9592987 to your computer and use it in GitHub Desktop.
Save ancillaryfactory/9592987 to your computer and use it in GitHub Desktop.
Starter Gruntfile and package.json
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
compress: true
},
build: {
src: [
'js/laika-css.js',
'js/laika-ui.js'
],
dest: 'js/laika.min.js'
}
},
// make a zipfile
compress: {
main: {
options: {
archive: 'build/<%= pkg.name %>-<%= pkg.version %>.zip'
},
files: [
{src: ['js/laika.min.js'], dest: ''},
{src: ['js/emmet.js'], dest: ''},
{src: ['css/**'], dest: ''},
{src: ['*.php'], dest: ''},
{src: ['readme.md'], dest: ''},
]
}
},
less: {
options: {
report: "min",
compress: true
},
// target name
src: {
expand: true,
cwd: "css",
src: "*.less",
ext: ".css"
}
},
watch: {
scripts: {
files: ['js/laika.js'],
tasks: ['uglify']
},
less: {
files: ['css/laika.less'],
tasks: ['less']
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-contrib-less');
// Default task(s).
grunt.registerTask('default', ['uglify','compress']);
grunt.registerTask('zip', ['compress']);
grunt.registerTask('ver', ['bump-only']);
};
{
"name": "my project",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-compress": "~0.5.3",
"grunt-bump": "0.0.13",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-less": "~0.8.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment