Skip to content

Instantly share code, notes, and snippets.

@joecue
Last active April 29, 2016 00:02
Show Gist options
  • Save joecue/23a09b6776f4c0bea14bf7effa34704f to your computer and use it in GitHub Desktop.
Save joecue/23a09b6776f4c0bea14bf7effa34704f to your computer and use it in GitHub Desktop.
LCCC WD2 - Sample Gulp file, and package json file
var project = 'twentyfifteen_child',
parentTheme = 'twentyfifteen',
gulp = require('gulp'),
sass = require('gulp-sass'),
notify = require('gulp-notify'),
header = require('gulp-header'),
plumber = require('gulp-plumber');
gulp.task('sass', function () {
return gulp.src('./themes/' + project + '/scss/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./themes/' + project + '/'))
.pipe(notify({ message: 'Yay! Sass is complete!', onLast: true}));
});
gulp.task('workingheader', function () {
var header = require('gulp-header');
gulp.src('./themes/' + project + '/style.css')
.pipe(header('/*!\nTheme Name: ${name}\n Theme URI: http://www.joequerin.com \n Description: Joe Querin Personal Portfolio Theme \n Author: Joe Querin \n Author URI: http://www.joequerin.com \n Template: ${name} \n Version:1.0.0 \n Template: ${parent} \n License: GNU General Public License v2 or later \n License URI: http://www.gnu.org/licenses/gpl-2.0.html \n Text Domain: ${name} */ \n ', { name : project, parent : parentTheme } ))
.pipe(gulp.dest('./themes/' + project + '/'))
.pipe(notify({ message: 'Working Header scripts task complete', onLast: true }));
});
gulp.task('sass:watch', function () {
gulp.watch('./themes/' + project + '/scss/style.scss', ['sass']);
});
gulp.task('watch', function () {
gulp.watch('./themes/' + project + '/**/*.scss', ['sass']);
gulp.watch('./themes/' + project + '/style.css', ['workingheader']);
});
gulp.task('default', ['watch']);
{
"name": "test-site",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-header": "^1.7.1",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-sass": "^2.3.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment