Merge pull request #563 from lilolbear/master - Thx @lilobear !
Gulp improvements and readme updates
This commit is contained in:
commit
9491fae58e
11
README.md
11
README.md
|
@ -95,11 +95,14 @@ To work and compile your Sass files on the fly start:
|
||||||
|
|
||||||
Or, to run with Browser-Sync:
|
Or, to run with Browser-Sync:
|
||||||
|
|
||||||
- First change the browser-sync options to reflect your environment in the file `/gulpfile.js` in the beginning of the file:
|
- First change the browser-sync options to reflect your environment in the file `/gulpconfig.json` in the beginning of the file:
|
||||||
```javascript
|
```javascript
|
||||||
var browserSyncOptions = {
|
{
|
||||||
proxy: "localhost/theme_test/", // <----- CHANGE HERE
|
"browserSyncOptions" : {
|
||||||
notify: false
|
"proxy": "localhost/theme_test/", // <----- CHANGE HERE
|
||||||
|
"notify": false
|
||||||
|
},
|
||||||
|
...
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
- then run: `$ gulp watch-bs`
|
- then run: `$ gulp watch-bs`
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
"paths" : {
|
"paths" : {
|
||||||
"js": "./js",
|
"js": "./js",
|
||||||
"css": "./css",
|
"css": "./css",
|
||||||
|
"img": "./img",
|
||||||
|
"imgsrc": "./src/img",
|
||||||
"sass": "./sass",
|
"sass": "./sass",
|
||||||
"node": "./node_modules/",
|
"node": "./node_modules/",
|
||||||
"bower": "./bower_components/",
|
"bower": "./bower_components/",
|
||||||
|
|
23
gulpfile.js
23
gulpfile.js
|
@ -103,16 +103,25 @@ gulp.task('watch', function () {
|
||||||
gulp.watch([paths.dev + '/js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']);
|
gulp.watch([paths.dev + '/js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']);
|
||||||
|
|
||||||
//Inside the watch task.
|
//Inside the watch task.
|
||||||
gulp.watch('./img/**', ['imagemin'])
|
gulp.watch(paths.imgsrc + '/**', ['imagemin-watch']);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures the 'imagemin' task is complete before reloading browsers
|
||||||
|
* @verbose
|
||||||
|
*/
|
||||||
|
gulp.task('imagemin-watch', ['imagemin'], function(done) {
|
||||||
|
browserSync.reload();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Run:
|
// Run:
|
||||||
// gulp imagemin
|
// gulp imagemin
|
||||||
// Running image optimizing task
|
// Running image optimizing task
|
||||||
gulp.task('imagemin', function(){
|
gulp.task('imagemin', function(){
|
||||||
gulp.src('img/src/**')
|
gulp.src(paths.imgsrc + '/**')
|
||||||
.pipe(imagemin())
|
.pipe(imagemin())
|
||||||
.pipe(gulp.dest('img'))
|
.pipe(gulp.dest(paths.img))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,10 +267,10 @@ gulp.task('clean-vendor-assets', function () {
|
||||||
// gulp dist
|
// gulp dist
|
||||||
// Copies the files to the /dist folder for distribution as simple theme
|
// Copies the files to the /dist folder for distribution as simple theme
|
||||||
gulp.task('dist', ['clean-dist'], function() {
|
gulp.task('dist', ['clean-dist'], function() {
|
||||||
return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'**', '!'+paths.node, '!'+paths.node+'**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!gulpfile.js', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*'])
|
return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'/**', '!'+paths.node, '!'+paths.node+'/**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!package-lock.json', '!gulpfile.js', '!gulpconfig.json', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*'], {'buffer': false})
|
||||||
.pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js'))
|
.pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js', {'skipBinary': true}))
|
||||||
.pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js'))
|
.pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js', {'skipBinary': true}))
|
||||||
.pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js'))
|
.pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js', {'skipBinary': true}))
|
||||||
.pipe(gulp.dest(paths.dist));
|
.pipe(gulp.dest(paths.dist));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in New Issue