mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-13 05:55:26 +00:00
update
This commit is contained in:
2
node_modules/bs-recipes/recipes/gulp.task.sequence/app/css/main.css
generated
vendored
Normal file
2
node_modules/bs-recipes/recipes/gulp.task.sequence/app/css/main.css
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
body {
|
||||
background: white; }
|
11
node_modules/bs-recipes/recipes/gulp.task.sequence/app/index.html
generated
vendored
Normal file
11
node_modules/bs-recipes/recipes/gulp.task.sequence/app/index.html
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Browsersync, Gulp, SASS + Slow tasks example</title>
|
||||
<link rel='stylesheet' href='css/main.css'>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Browsersync, Gulp, SASS + Slow tasks example</h1>
|
||||
</body>
|
||||
</html>
|
3
node_modules/bs-recipes/recipes/gulp.task.sequence/app/scss/main.scss
generated
vendored
Normal file
3
node_modules/bs-recipes/recipes/gulp.task.sequence/app/scss/main.scss
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
body {
|
||||
background: white;
|
||||
}
|
5
node_modules/bs-recipes/recipes/gulp.task.sequence/desc.md
generated
vendored
Normal file
5
node_modules/bs-recipes/recipes/gulp.task.sequence/desc.md
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
This example highlights a common problem where you don't want to reload
|
||||
the browser until a 2 or more slow-running tasks have completed. The solution
|
||||
is to create the intermediate task that ensures `browserSync.reload` is not
|
||||
called until both slow tasks are complete.
|
57
node_modules/bs-recipes/recipes/gulp.task.sequence/gulpfile.js
generated
vendored
Normal file
57
node_modules/bs-recipes/recipes/gulp.task.sequence/gulpfile.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
var gulp = require('gulp');
|
||||
var browserSync = require('browser-sync');
|
||||
var sass = require('gulp-sass');
|
||||
var reload = browserSync.reload;
|
||||
var through = require("through2");
|
||||
|
||||
/**
|
||||
* A slow task
|
||||
*/
|
||||
gulp.task('slow1', function () {
|
||||
return gulp.src('./app/*.html')
|
||||
.pipe(slowStream());
|
||||
});
|
||||
|
||||
/**
|
||||
* Another Slow task
|
||||
*/
|
||||
gulp.task('slow2', function () {
|
||||
return gulp.src('./app/*.html')
|
||||
.pipe(slowStream());
|
||||
});
|
||||
|
||||
/**
|
||||
* Separate task for the reaction to a file change
|
||||
*/
|
||||
gulp.task('html-watch', ['slow1', 'slow2'], reload);
|
||||
|
||||
/**
|
||||
* Sass task for live injecting into all browsers
|
||||
*/
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./app/scss/*.scss')
|
||||
.pipe(sass())
|
||||
.pipe(gulp.dest('./app/css'))
|
||||
.pipe(reload({stream: true}));
|
||||
});
|
||||
|
||||
/**
|
||||
* Serve and watch the html files for changes
|
||||
*/
|
||||
gulp.task('default', function () {
|
||||
|
||||
browserSync({server: './app'});
|
||||
|
||||
gulp.watch('./app/scss/*.scss', ['sass']);
|
||||
gulp.watch('./app/*.html', ['html-watch']);
|
||||
});
|
||||
|
||||
/**
|
||||
* Simulate a slow task
|
||||
*/
|
||||
function slowStream () {
|
||||
return through.obj(function (file, enc, cb) {
|
||||
this.push(file);
|
||||
setTimeout(cb, 2000);
|
||||
});
|
||||
}
|
17
node_modules/bs-recipes/recipes/gulp.task.sequence/package.json
generated
vendored
Normal file
17
node_modules/bs-recipes/recipes/gulp.task.sequence/package.json
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "gulp.sass",
|
||||
"version": "1.0.0",
|
||||
"description": "Gulp, SASS + Slow running tasks",
|
||||
"main": "gulpfile.js",
|
||||
"scripts": {
|
||||
"start": "gulp"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"browser-sync": "^2.2.0",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-sass": "^1.3.3",
|
||||
"through2": "^0.6.3"
|
||||
}
|
||||
}
|
97
node_modules/bs-recipes/recipes/gulp.task.sequence/readme.md
generated
vendored
Normal file
97
node_modules/bs-recipes/recipes/gulp.task.sequence/readme.md
generated
vendored
Normal file
@ -0,0 +1,97 @@
|
||||
#Browsersync - Gulp, SASS + Slow running tasks
|
||||
|
||||
## Installation/Usage:
|
||||
|
||||
To try this example, follow these 4 simple steps.
|
||||
|
||||
**Step 1**: Clone this entire repo
|
||||
```bash
|
||||
$ git clone https://github.com/Browsersync/recipes.git bs-recipes
|
||||
```
|
||||
|
||||
**Step 2**: Move into the directory containing this example
|
||||
```bash
|
||||
$ cd bs-recipes/recipes/gulp.task.sequence
|
||||
```
|
||||
|
||||
**Step 3**: Install dependencies
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
**Step 4**: Run the example
|
||||
```bash
|
||||
$ npm start
|
||||
```
|
||||
|
||||
### Additional Info:
|
||||
|
||||
|
||||
|
||||
This example highlights a common problem where you don't want to reload
|
||||
the browser until a 2 or more slow-running tasks have completed. The solution
|
||||
is to create the intermediate task that ensures `browserSync.reload` is not
|
||||
called until both slow tasks are complete.
|
||||
|
||||
|
||||
### Preview of `gulpfile.js`:
|
||||
```js
|
||||
var gulp = require('gulp');
|
||||
var browserSync = require('browser-sync');
|
||||
var sass = require('gulp-sass');
|
||||
var reload = browserSync.reload;
|
||||
var through = require("through2");
|
||||
|
||||
/**
|
||||
* A slow task
|
||||
*/
|
||||
gulp.task('slow1', function () {
|
||||
return gulp.src('./app/*.html')
|
||||
.pipe(slowStream());
|
||||
});
|
||||
|
||||
/**
|
||||
* Another Slow task
|
||||
*/
|
||||
gulp.task('slow2', function () {
|
||||
return gulp.src('./app/*.html')
|
||||
.pipe(slowStream());
|
||||
});
|
||||
|
||||
/**
|
||||
* Separate task for the reaction to a file change
|
||||
*/
|
||||
gulp.task('html-watch', ['slow1', 'slow2'], reload);
|
||||
|
||||
/**
|
||||
* Sass task for live injecting into all browsers
|
||||
*/
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./app/scss/*.scss')
|
||||
.pipe(sass())
|
||||
.pipe(gulp.dest('./app/css'))
|
||||
.pipe(reload({stream: true}));
|
||||
});
|
||||
|
||||
/**
|
||||
* Serve and watch the html files for changes
|
||||
*/
|
||||
gulp.task('default', function () {
|
||||
|
||||
browserSync({server: './app'});
|
||||
|
||||
gulp.watch('./app/scss/*.scss', ['sass']);
|
||||
gulp.watch('./app/*.html', ['html-watch']);
|
||||
});
|
||||
|
||||
/**
|
||||
* Simulate a slow task
|
||||
*/
|
||||
function slowStream () {
|
||||
return through.obj(function (file, enc, cb) {
|
||||
this.push(file);
|
||||
setTimeout(cb, 2000);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
Reference in New Issue
Block a user