Closed shelldandy closed 6 years ago
Im not sure about this file
I really have no idea why the .tmp
folder exists as far as i can tell there is a copy task that first moves the entire src folder into .tmp/src then another task is copying those tmp files into the final folder then another task reads some files from the tmp folder and uses them as injection points for the gulp-inject task.
I think this all could be done on a single gulp task without the need to create temporary folders.
Also another bad side effect with all of this copying files around is that in the end we get the bower_components
folder onto the deliverable dist
folder.
Another not so great side effect is that if we want to add another layout on our templates then we must manually go to the inject.js gulp task to tell it to also inject the js there.
So yeah, its complicated 😁
But i leave the issue so its food for thought for you to think a way to improve this workflow of the temporary folders stravaganza
I think i have an idea of how to remove the tmp folder, the thing with the tmp folder is to copy the generated js and css to then be injected onto the final files right?
So right now you have two tasks generation and injection, i think both tasks could be made on a single step
Pseudocode here:
gulp.task('sass', done => {
let sass = gulp.src .... // all of the gulp to get the compiled css but without writing it
gulp.src(//the html files)
.pipe(inject(gulp.src(sass), {ignorePath: '.tmp'})) // you see what i did there??
.pipe(gulp.dest(distFolder)
})
Something like that SHOULD work and at the same time would remove the need for a tmp folder
Maybe refactor the code to avoid the need of a
.tmp
folder (maybe is something jekyll does?)