Last active
October 8, 2018 19:16
-
-
Save danielpataki/149e592a5bb2fc28839e2f2080e4c333 to your computer and use it in GitHub Desktop.
Gulp
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
var cleanCSS = require('gulp-clean-css'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var sass = require('gulp-sass'); |
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
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('./')); | |
}) | |
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
npm i -D gulp |
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
var gulp = require('gulp'); | |
var imagemin = require('gulp-imagemin'); | |
gulp.task('default', function() { | |
// place code for your default task here | |
}); |
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
var gulp = require('gulp'); | |
gulp.task('default', function() { | |
// place code for your default task here | |
}); |
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
npm i -D gulp-sass gulp-autoprefixer gulp-clean-css |
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
npm i -D gulp-image-optimization |
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
npm install --global gulp-cli |
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
npm install --save-dev package1 package2 package3 | |
# alrenative shorthand | |
npm i -D package1 package2 package3 |
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
gulp.task('optimize-images', function(cb) { | |
gulp.src(['./*.png','./*.jpg','./*.gif','./*.jpeg', './images/**/*.*']) | |
.pipe(imagemin()) | |
.pipe(gulp.dest('./')) | |
}); |
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
mkdir example-gulp-theme && cd example-gulp-theme | |
touch header.php footer.php functions.php index.php style.css | |
npm init |
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
html{background:#f90;transition:all .2s linear;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none} |
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
/* | |
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; | |
} |
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
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