Last active
August 19, 2018 19:04
-
-
Save jh3y/3ecafb96903e069bf640b5290ef9985a to your computer and use it in GitHub Desktop.
serve.js
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
const browsersync = require('browser-sync'), | |
vf = require('vinyl-file'), | |
vss = require('vinyl-source-stream'), | |
vb = require('vinyl-buffer'); | |
const start = () => { | |
const server = browsersync.create(); | |
server.init({ | |
baseDir: 'public/' | |
}); | |
return server.watch('public/**', (evt, file) => { | |
if (evt === 'change' && file.indexOf('.css') === -1) | |
server.reload(); | |
if (evt === 'change' && file.indexOf('.css') !== -1) | |
vf.readSync(file) | |
.pipe(vss(file)) | |
.pipe(vb()) | |
.pipe(server.stream()); | |
}); | |
}; |
@firestar300 Do you found any solution?
if anybody want to use this code, you should use vinyl-file version 2.0.0, if anybody found other solution please put it here :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice gist ! But i have this error : vf.readSync(...).pipe is not a function