Skip to content

Instantly share code, notes, and snippets.

@jasterix
Created June 23, 2020 23:57
Show Gist options
  • Save jasterix/d71c9022cf56a27e629fca69621b9f6a to your computer and use it in GitHub Desktop.
Save jasterix/d71c9022cf56a27e629fca69621b9f6a to your computer and use it in GitHub Desktop.
module.exports = function (grunt) {
grunt.initConfig({
// jshint: {
// browser: ["public/js/**/*.js"],
// },
jshint: {
client: ["public/js/**/*.js", "!public/js/vendor"],
},
// less: {
// compile: {
// files: {
// "build/css/compiled.css": [
// "public/css/layout.less",
// "public/css/components.less",
// "public/css/views/foo.less",
// "public/css/views/bar.less",
// ],
// },
// },
// },
less: {
compile: {
files: {
"build/css/compiled.css": "public/css/**/*.less",
},
},
},
concat: {
js: {
files: {
"build/js/bundle.js": "src/**/*.js",
},
},
},
// uglify: {
// cobra: {
// files: {
// "build/js/cobra.min.jss": "build/js/bundle.js",
// },
// },
// },
uglify: {
bundle: {
files: {
"build/js/bundle.min.js": "build/js/bundle.js",
},
},
},
sprite: {
icons: {
src: "public/img/icons/*.png",
destImg: "build/img/icons.png",
destCSS: "build/css/icons.css",
},
},
clean: {
js: "build/js",
css: "build/css",
less: "public/**/*.css",
},
timestamp: {
options: {
file: "build/timestamp.js",
},
},
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-spritesmith");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.registerTask("default", ["jshint"]);
grunt.registerTask(
"jstasks",
"Concatenate and minify static JavaScript assets",
["concat:js", "uglify:bundle"]
);
grunt.registerTask("timestamp", function () {
let options = this.options({
file: ".timestamp",
});
let timestamp = new Date();
let contents = timestamp.toString();
grunt.file.write(options.file, contents);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment