Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulp
var cleanCSS = require('gulp-clean-css');
var autoprefixer = require('gulp-autoprefixer');
var sass = require('gulp-sass');
gulp.task('css', function() {
gulp.src('./*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('./'));
})
npm i -D gulp
var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
gulp.task('default', function() {
// place code for your default task here
});
var gulp = require('gulp');
gulp.task('default', function() {
// place code for your default task here
});
npm i -D gulp-sass gulp-autoprefixer gulp-clean-css
npm i -D gulp-image-optimization
npm install --global gulp-cli
npm install --save-dev package1 package2 package3
# alrenative shorthand
npm i -D package1 package2 package3
gulp.task('optimize-images', function(cb) {
gulp.src(['./*.png','./*.jpg','./*.gif','./*.jpeg', './images/**/*.*'])
.pipe(imagemin())
.pipe(gulp.dest('./'))
});
mkdir example-gulp-theme && cd example-gulp-theme
touch header.php footer.php functions.php index.php style.css
npm init
html{background:#f90;transition:all .2s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
/*
Theme Name: Gulp Test Theme
Description: A quick WordPress Gulp example theme
Author: Daniel Pataki
Author URI: http://danielpataki.com
Version: 1.0.0
*/
$bg: #ff9900;
html {
background: $bg;
transition: all 200ms linear;
user-select:none;
}
gulp.task('watch-css', function () {
gulp.watch('./*.scss', ['css']);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.