Grunt JS Tutorial #5 - Compiling SASS
1. Installed node-sass grunt-sass 2. Added `const sass = require('node-sass'); 3. Added initConfig Note: SASS to CSS is not successful, has to deal with it latermaster
parent
721f114286
commit
acf6665056
19
Gruntfile.js
19
Gruntfile.js
|
@ -1,5 +1,8 @@
|
||||||
module.exports = function(grunt){
|
module.exports = function(grunt){
|
||||||
|
|
||||||
|
const sass = require('node-sass');
|
||||||
|
// require('load-grunt-tasks')(grunt);
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
// pass in options to plugin, references to file, etc.
|
// pass in options to plugin, references to file, etc.
|
||||||
|
@ -10,15 +13,27 @@ module.exports = function(grunt){
|
||||||
dest: 'build/scripts.js'
|
dest: 'build/scripts.js'
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
src: ['css/*.css'],
|
src: ['css/reset.css', 'css/bootstrap.css', 'css/styles.css'],
|
||||||
dest: 'build/styles.js'
|
dest: 'build/styles.js'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
sass: {
|
||||||
|
options: {
|
||||||
|
implementation: sass,
|
||||||
|
sourceMap: true
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
files: {
|
||||||
|
'css/sass/styles.scss': 'css/styles.css'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load plugins
|
// Load plugins
|
||||||
grunt.loadNpmTasks('grunt-contrib-concat')
|
grunt.loadNpmTasks('grunt-contrib-concat')
|
||||||
require('load-grunt-tasks')(grunt);
|
grunt.loadNpmTasks('grunt-sass');
|
||||||
|
|
||||||
// Register tasks
|
// Register tasks
|
||||||
grunt.registerTask('concat-js', ['concat:js']);
|
grunt.registerTask('concat-js', ['concat:js']);
|
||||||
|
|
|
@ -2,6 +2,8 @@ $base-color: #777;
|
||||||
$second-color: #333;
|
$second-color: #333;
|
||||||
$heading-font: Arial;
|
$heading-font: Arial;
|
||||||
|
|
||||||
|
@import 'mixins';
|
||||||
|
|
||||||
.element {
|
.element {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
|
@ -18,4 +20,5 @@ $heading-font: Arial;
|
||||||
|
|
||||||
.heading{
|
.heading{
|
||||||
font-family: $heading-font;
|
font-family: $heading-font;
|
||||||
|
@include ninjalink ('blue', 'red', 'pink', 'purple')
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,9 @@
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "^1.3.0",
|
"grunt": "^1.3.0",
|
||||||
"grunt-contrib-concat": "^1.0.1"
|
"grunt-contrib-concat": "^1.0.1",
|
||||||
|
"grunt-sass": "^3.1.0",
|
||||||
|
"node-sass": "^5.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
|
Loading…
Reference in New Issue