Skip to content

Instantly share code, notes, and snippets.

@nakajmg
Last active December 29, 2015 10:09
Show Gist options
  • Save nakajmg/7654743 to your computer and use it in GitHub Desktop.
Save nakajmg/7654743 to your computer and use it in GitHub Desktop.
Grunt setting files
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options: {
style: 'expanded',
lineNumbers: true,
// compass: true
},
files: [{
expand: true,
cwd: 'sass',
src: ['*.scss'],
dest: './css',
ext: '.css'
}]
}
},
csso: {
dist: {
files: {
'./css/all.min.css': ['./css/*.css','!./css/all.min.css']
}
}
},
uglify: {
target: {
files: { './js/all.min.js': ['./js/*.js','!./js/all.min.js'] }
}
},
autoprefixer: {
options: {
browsers: ['ios >= 5','android >= 2.3']
},
dist: {
src: './css/all.css'
}
},
connect: {
dist: {
options: {
port: 8080,
base: '.',
open: 'http://localhost:8080/index.html'
}
}
},
watch: {
sass: {
files: ['./sass/*.scss'],
tasks: ['sass'],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-csso');
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.registerTask('default',['develop']); //Default task.
grunt.registerTask('develop',['connect','watch']);
grunt.registerTask('publish',['autoprefixer','csso','uglify']);
};
{
"name": "grunt template",
"version": "0.0.0",
"description": "grunt template",
"main": "Gruntfile.js",
"scripts": {
"test": "\"echo \\\"Error: no test specified\\\" && exit 1\""
},
"author": "nakajmg",
"license": "BSD",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-sass": "~0.5.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-uglify": "~0.2.4",
"grunt-csso": "~0.5.0",
"grunt-autoprefixer": "~0.4.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment