You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In index.pug script file is being loaded as if it is already in public/js folder but there doesn't seem to be a gulp task to move the js file into this folder automatically. I'll be looking getting this to working this week, so I will post my solution :)
I know, I know. It's been a while! But here it is...
In gulpfile.js
In paths obj, add this entry: js: './public/js/'
Add a gulp task for JS using the path we just made.
gulp.task('js', function () {
return gulp.src('./src/js/**/*.js')
.pipe(gulp.dest(paths.js))
});
In the existing gulp ‘rebuild’ task add the js task just created
gulp.task('rebuild', ['pug', **'js'**], function () {
….
)};
In the gulp ‘watch’ task, add: gulp.watch('./src/**/*.js', ['rebuild']);
This watches the js files for changes, and then fires the rebuild task we updated a second ago.
Now, adding something like this to src/js/scripts.js should result in an output in the browser.
console.log('<3 js');
Make sure to re-run gulp so that it picks up the changes we made to gulpfile.js
Thanks for making this, it is very nice.
I have encountered 1 prob, though, which follows.
steps:
Any ideas?
Thanks!
The text was updated successfully, but these errors were encountered: