Created
May 9, 2018 00:03
-
-
Save petertwise/a27671c96f3d226e0d4b9a118bfd1314 to your computer and use it in GitHub Desktop.
My Grunt Setup - no ruby required version
This file contains 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
// inspired by https://gist.github.com/jshawl/6225945 | |
// Thanks @jshawl! | |
// now using grunt-sass to avoid Ruby dependency | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { // sass tasks | |
dist: { | |
files: { | |
'dist/css/main.min.css': 'css/main.scss' // this is our main scss file | |
} | |
}, | |
options: { | |
compass: true, | |
style: 'compressed', | |
sourceMap: true | |
} | |
}, | |
autoprefixer:{ | |
dist:{ | |
options: { | |
map: true | |
}, | |
files:{ | |
'dist/css/main.min.css':'dist/css/main.min.css' | |
} | |
} | |
}, | |
uglify: { | |
dist: { | |
files: [{ | |
expand: true, | |
src: '**/*.js', | |
dest: 'dist/js', | |
cwd: 'js', | |
rename: function(dest, src) { return dest + '/' + src.replace('.js', '.min.js'); }, | |
}], | |
} | |
}, | |
watch: { | |
css: { | |
files: ['css/*.scss', 'js/*.js'], | |
tasks: ['sass', 'autoprefixer', 'uglify'] | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-sass'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-autoprefixer');; | |
grunt.registerTask('default',['sass', 'autoprefixer', 'uglify', 'watch']); | |
} |
This file contains 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
{ | |
"name": "squarecandy-EXAMPLE", | |
"version": "1.0.0", | |
"description": "Square Candy's Example Setup", | |
"repository": { | |
"type": "git", | |
"url": "git+https://github.com/squarecandy/squarecandy-EXAMPLE.git" | |
}, | |
"author": "Square Candy Design / Peter Wise", | |
"license": "GPL-3.0", | |
"bugs": { | |
"url": "https://github.com/squarecandy/squarecandy-EXAMPLE/issues" | |
}, | |
"homepage": "https://github.com/squarecandy/squarecandy-EXAMPLE#readme", | |
"devDependencies": { | |
"grunt": "^1.0.1", | |
"grunt-autoprefixer": "^3.0.4", | |
"grunt-contrib-uglify": "^3.0.0", | |
"grunt-contrib-watch": "^1.0.0", | |
"grunt-sass": "^2.1.0", | |
"node-sass": "^4.9.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment