Last active
August 19, 2016 07:56
-
-
Save devkinetic/5919468f4052b53ece156961226e565c to your computer and use it in GitHub Desktop.
Sass / Grunt - D8 theme
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
module.exports = function (grunt) { | |
"use strict"; | |
require('load-grunt-tasks')(grunt); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { | |
prod: { | |
options: { | |
outputStyle: 'compressed' | |
}, | |
files: { | |
'css/style.css': 'sass/style.scss', | |
} | |
}, | |
dev: { | |
options: { | |
outputStyle: 'expanded', | |
sourceMap: true | |
}, | |
files: { | |
'css/style.css': 'sass/style.scss', | |
} | |
} | |
}, | |
postcss: { | |
prod: { | |
options: { | |
processors: [ | |
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes | |
require('cssnano')() // minify the result | |
] | |
}, | |
dist: { | |
src: 'css/*.css' | |
} | |
}, | |
dev: { | |
options: { | |
processors: [ | |
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes | |
] | |
}, | |
dist: { | |
src: 'css/*.css' | |
} | |
} | |
}, | |
watch: { | |
css: { | |
files: ['sass/**/*.scss'], | |
tasks: ['sass:dev', 'postcss:dev'], | |
options: { | |
livereload: true | |
} | |
}, | |
templates: { | |
files: ['templates/**/*.twig'], | |
options: { | |
livereload: true | |
} | |
} | |
} | |
}); | |
// Default task. | |
grunt.registerTask('build', ['sass:prod','postcss:prod']); | |
grunt.registerTask('default', ['sass:dev','postcss:dev']); | |
}; |
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
{ | |
"name": "drupal-custom-theme", | |
"version": "0.1.0", | |
"devDependencies": { | |
"autoprefixer": "^6.3.6", | |
"cssnano": "^3.7.1", | |
"grunt": "^1.0.1", | |
"grunt-contrib-watch": "^1.0.0", | |
"grunt-postcss": "^0.8.0", | |
"grunt-sass": "^1.2.0", | |
"load-grunt-tasks": "^3.5.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment