Last active
August 29, 2015 14:17
-
-
Save WISHPRO/25e172db4787fd548e3f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals module, require */ | |
module.exports = function (grunt) { | |
"use strict"; | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON("package.json"), | |
jshint: { | |
all: ['Gruntfile.js', 'js/app.js'] | |
}, | |
/* | |
Concatenate & Minify Javascript files | |
@author: https://github.com/gruntjs/grunt-contrib-concat | |
@author: https://github.com/gruntjs/grunt-contrib-uglify | |
*/ | |
concat: { | |
options: { | |
separator: ';', | |
}, | |
dist: { | |
src: ['js/vendor/*.js', 'js/vendor/*/*.js', 'js/app.js'], | |
dest: 'js/app-dist.js', | |
}, | |
}, | |
uglify: { | |
global: { | |
files: { | |
"js/app-dist.js": ["js/app-dist.js"] | |
} | |
} | |
}, | |
/* | |
Combine LESS files into CSS | |
@author: https://github.com/gruntjs/grunt-contrib-less | |
*/ | |
less: { | |
production: { | |
options: { | |
paths: ["css/"], | |
cleancss: true | |
}, | |
files: { | |
"style-prod.css": "style.less" | |
} | |
} | |
}, | |
/* | |
Add vendor prefixes | |
@author: https://github.com/nDmitry/grunt-autoprefixer | |
*/ | |
autoprefixer: { | |
global: { | |
src: "style-prod.css", | |
dest: "style.css" | |
} | |
}, | |
/* | |
Combine Media Queries | |
@author: https://github.com/frontendfriends/grunt-combine-mq | |
@example: base file has 70 @media while output has only 12 | |
*/ | |
combine_mq: { | |
new_filename: { | |
options: { | |
expand: false, | |
beautify: false | |
}, | |
src: 'style-prod.css', | |
dest: 'style.css' | |
} | |
}, | |
/* | |
Minify Stylehseets for production | |
@author: https://github.com/gruntjs/grunt-contrib-cssmin | |
*/ | |
cssmin: { | |
target: { | |
files: { | |
'style-prod.css': ['style.css'] | |
} | |
} | |
}, | |
watch: { | |
options: { | |
livereload: { | |
port: 9000 | |
} | |
}, | |
js: { | |
files: ["js/*.js"], | |
tasks: ["concat", "uglify"] | |
}, | |
css: { | |
files: ["style.less"], | |
tasks: ["less", "combine_mq", "cssmin"] | |
}, | |
svgIcons: { | |
files: ["svg/*.svg"], | |
tasks: ["svgstore"] | |
} | |
}, | |
svgstore: { | |
options: { | |
prefix: "shape-", | |
cleanup: true | |
}, | |
default: { | |
files: { | |
"images/svg-defs.svg": ["svg/*.svg"] | |
} | |
} | |
}, | |
dploy: { | |
live: { | |
host: "", | |
user: "", | |
pass: "", | |
path: { | |
local: "", | |
remote: "/public_html/" | |
}, | |
exclude: ["Gruntfile.js", "package.json", "README.MD", "js/vendor", "less", "svg", "style.less"] | |
} | |
} | |
}); | |
require("load-grunt-tasks")(grunt); | |
grunt.registerTask("serve"); | |
grunt.registerTask("default", ["jshint", "concat", "uglify", "less", "combine_mq", "cssmin", "svgstore", "watch"]); | |
grunt.registerTask("build", ["jshint", "concat", "uglify", "less", "combine_mq", "cssmin", "svgstore", "dploy"]); | |
grunt.registerTask("deploy", ["dploy"]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment