Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-cssbeautifier');
grunt.loadNpmTasks('grunt-strip-css-comments');
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
// Define paths.
paths: {
sass: 'source/sass',
devCSS: 'css',
prodCSS: 'source/deploy/styles',
}, // paths
uglify: {
global: {
files: {
"js/site.min.js": ['source/js/*.js']
}
}
}, // uglify
cssbeautifier: {
global: {
files: {
src: ['css/*.css']
},
options: {
indent: ' ',
openbrace: 'end-of-line',
autosemicolon: false
}
}
}, // cssbeautifier
stripCssComments: {
global: {
files: [{
expand: true,
src: ['css/*.css']
}]
}
}, // stripCssComments
sass: {
global: {
options: {
sourceMap: true,
sourceComments: false,
outputStyle: 'expanded'
},
files: [{
expand: true,
cwd: '<%= paths.sass %>/',
src: ['**/*.scss'],
dest: '<%= paths.devCSS %>/',
ext: '.css'
},
],
}
}, // sass
watch: {
options: {
livereload: true
},
site: {
files: ['templates/**/*.tpl.php', 'js/**/*.{js,json}', 'css/*.css', 'images/**/*.{png,jpg,jpeg,gif,webp,svg}']
},
js: {
files: ['source/js/*.js'],
tasks: ["uglify"]
},
css: {
files: ["source/sass/**/*.scss"],
tasks: ["sass"]
},
} // watch
});
require("load-grunt-tasks")(grunt);
// grunt command
grunt.registerTask("default", ["sass", "watch"]);
// grunt format command (run before code commit)
grunt.registerTask("format", ["stripCssComments", "cssbeautifier"]);
};
{
"name": "Gratis-LibSass",
"version": "0.0.1",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-autoprefixer": "~0.8.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-handlebars": "~0.7.0",
"grunt-contrib-uglify": "~0.5.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-cssbeautifier": "^0.1.2",
"grunt-sass": "^0.17.0",
"grunt-shell": "~0.6.4",
"grunt-strip-css-comments": "^1.0.0",
"load-grunt-tasks": "~0.2.1",
"node-bourbon": "^1.2.3",
"node-neat": "^1.3.0",
"susy": "^2.2.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.