Skip to content

Instantly share code, notes, and snippets.

@holisticnetworking
Created December 30, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holisticnetworking/244ecfece50778d0642c8522e25fc4ef to your computer and use it in GitHub Desktop.
Save holisticnetworking/244ecfece50778d0642c8522e25fc4ef to your computer and use it in GitHub Desktop.
User input sass watching.
/**
* 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