Created
December 30, 2017 22:45
-
-
Save holisticnetworking/244ecfece50778d0642c8522e25fc4ef to your computer and use it in GitHub Desktop.
User input sass watching.
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
/** | |
* HN Build Tools | |
* Contains build tools for developing HNReactive themes. This includes SASS compilation, | |
* CSS/JS minification and concatenation. | |
* @type {*|Gulp} | |
*/ | |
"use strict"; | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var theme = 'HNReactiveChild'; | |
var parentDir = '../HNReactive/Library/scss/'; | |
var foundation = '../HNReactive/vendor/foundation/'; | |
var sassPaths = [ | |
foundation + 'bower_components/foundation-sites/scss', | |
foundation + 'bower_components/motion-ui/src' | |
]; | |
gulp.task('sass', function() { | |
$.util.log('Change detected. Building ' + theme + ' CSS...'); | |
return gulp.src('../' + theme + '/Library/scss/app.scss') | |
.pipe($.sass({ | |
includePaths: sassPaths | |
}) | |
.on('error', $.sass.logError)) | |
.pipe(gulp.dest('../' + theme + '/Resource/css')); | |
}); | |
gulp.task('watch-child', ['sass'], function() { | |
gulp.src('base.scss') | |
.pipe($.prompt.prompt( | |
{ | |
'type': 'input', | |
'name': 'theme', | |
'message': 'Target theme slug?' | |
}, | |
function(res) { | |
if( res.theme && 0 <= res.theme.length ) { | |
theme = res.theme; | |
} | |
$.util.log(theme); | |
gulp.watch([ | |
'../' + theme + '/Library/scss/**/*.scss', | |
parentDir + '/hn-reactive/**/*.scss' | |
], ['sass']); | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment