Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var src = "src";
- var build = "build";
- module.exports = function(grunt) {
- grunt.initConfig({
- babel: {
- options: {
- experimental: true,
- compact: false,
- comments: true
- },
- scripts: {
- options: {},
- files: [{
- expand: true,
- cwd: src,
- dest: build,
- src: ["**/*.js"]
- }]
- }
- },
- concat: {
- },
- uglify: {
- minify: {
- options: {
- beautify: false,
- compress: {
- sequences: true,
- properties: true,
- dead_code: true,
- drop_debugger: true,
- conditionals: true,
- comparisons: true,
- evaluate: true,
- booleans: true,
- loops: true,
- unused: true,
- hoist_funs: true,
- if_return: true,
- join_vars: true,
- cascade: true,
- negate_iife: true
- },
- mangle: true
- },
- files: [{
- expand: true,
- cwd: build,
- dest: build,
- ext: ".min.js",
- extDot: "last",
- src: ["**/*.js", "!**/*.min.js"]
- }]
- },
- beautify: {
- options: {
- beautify: {
- beautify: true,
- width: 200,
- space_colon: false
- },
- compress: false,
- screw_ie8: true,
- mangle: false
- },
- files: [{
- expand: true,
- cwd: build,
- dest: build,
- src: ["**/*.js", "!**/*.min.js"]
- }]
- }
- },
- less: {
- compile: {
- options: {
- ieCompat: false
- },
- files: [{
- expand: true,
- cwd: src,
- dest: build,
- ext: ".css",
- extDot: "last",
- src: ["**/*.less", "!**/*.import.less"]
- }]
- }
- },
- cssmin: {
- minify: {
- files: [{
- expand: true,
- cwd: build,
- dest: build,
- ext: ".min.css",
- extDot: "last",
- src: ["**/*.css", "!**/*.min.css"]
- }]
- }
- },
- htmlmin: {
- minify: {
- options: {
- removeComments: true,
- useShortDoctype: true,
- customAttrAssign: [/\?=/g, /\$=/g],
- minifyJS: true,
- minifyCSS: true,
- collapseWhitespace: true
- },
- files: [{
- expand: true,
- cwd: build,
- dest: build,
- ext: ".min.html",
- extDot: "last",
- src: ["**/*.html", "!**/*.min.html"]
- }]
- }
- },
- vulcanize: {
- elements: {
- options: {
- inlineScripts: true,
- inlineCss: true
- },
- files: {
- "build/vulcanized.html": "build/elements.html"
- }
- }
- },
- copy: {
- appcache: {
- files: [{
- expand: true,
- cwd: src,
- dest: build,
- src: ["**/*.appcache"]
- }]
- },
- html: {
- files: [{
- expand: true,
- cwd: src,
- dest: build,
- src: ["**/*.html"]
- }]
- }
- },
- watch: {
- options: {
- atBegin: true
- },
- transpileScripts: {
- files: [src + "/**/*.js"],
- tasks: ["babel"]
- },
- /*concatAsync: {
- files: [src + "/../scripts/*.js"],
- tasks: ["concat:async"]
- },*/
- minifyScripts: {
- files: [build + "/**/*.js", "!" + build + "/**/*.min.js"],
- tasks: ["uglify:minify"]
- },
- beautifyScripts: {
- files: [build + "/**/*.js", "!" + build + "/**/*.min.js"],
- tasks: ["uglify:beautify"]
- },
- compileLESS: {
- files: [src + "/**/*.less", "!" + src + "/**/*.import.less"],
- tasks: ["less:compile"]
- },
- minifyCSS: {
- files: [build + "/**/*.css", "!" + build + "/**/*.min.css"],
- tasks: ["cssmin:minify"]
- },
- copyHTML: {
- files: [src + "/**/*.html"],
- tasks: ["copy"]
- },
- minifyHTML: {
- files: [build + "/**/*.html"],
- tasks: ["htmlmin:minify"]
- },
- /*vulcanizePolymer: {
- files: ["src/*"],
- tasks: ["vulcanize:elements"]
- },*/
- copyAppcache: {
- files: [src + "/**/*.appcache"],
- tasks: ["copy"]
- },
- }
- });
- grunt.loadNpmTasks("grunt-contrib-concat");
- grunt.loadNpmTasks("grunt-babel");
- grunt.loadNpmTasks("grunt-contrib-uglify");
- grunt.loadNpmTasks("grunt-contrib-less");
- grunt.loadNpmTasks("grunt-contrib-cssmin");
- grunt.loadNpmTasks("grunt-vulcanize");
- grunt.loadNpmTasks("grunt-contrib-htmlmin");
- grunt.loadNpmTasks('grunt-contrib-copy');
- grunt.loadNpmTasks("grunt-contrib-watch");
- grunt.registerTask("default", ["watch"]);
- grunt.registerTask("run", ["copy", "babel", "concat", "uglify", "less", "cssmin", /*"vulcanize",*/ "htmlmin"]);
- };
- /*
- var package = {
- "dependencies": {
- "grunt": "",
- "grunt-cli": "",
- "grunt-contrib-copy": "",
- "grunt-contrib-cssmin": "",
- "grunt-contrib-htmlmin": "",
- "grunt-contrib-less": "",
- "grunt-contrib-uglify": "",
- "grunt-contrib-watch": "",
- "grunt-contrib-concat": "",
- "grunt-vulcanize": "",
- "grunt-babel": ""
- }
- };
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement