-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foundation Template Build Time #10811
Comments
Have you tried using yarn? My project compiles in under ten seconds, though admittedly I do clean up a lot of unnecessary modules (that aren't used in my project). Using yarn start, a change reflects/compiles in 1.1s and browsersync refreshes instantly. This is on a i7 4720HQ. Using npm, it's 3.2s |
Which node modules do you use in your build setup? |
@marcoValkyriweb I am not using yarn. I am literally just using the default setup @DanielRuf and adding a little bit of scss and javascript and it slows down a lot. The build time for production is not what concerns me, more the watch time. HTML changes are detected fast, but JS and SCSS just takes a long time. |
Isn't gulp used by default? Did you try a clean webpack setup? In my experience an incremental webpack build was much faster. |
@phifa my JS and SCSS changes are within half a second of saving (as in change detected to start the compile), npm is also quite fast though. To use yarn: https://www.sitepoint.com/yarn-vs-npm/ Changing SCSS: [11:50:41] Starting 'sass'...
[Browsersync] 1 file changed (app.css)
[11:50:42] Finished 'sass' after 1.31 s For the following code, including adding the file to my app.scss: .footer-container {
background-color: $gray-footer;
color: white;
h3 {
color: white;
}
a {
color: white;
}
p {
margin-bottom: unset;
}
svg {
color: $secondary-blue;
}
background: { //added this one to add more specifics
color: red;
repeat: unset;
}
} |
I was running into ~30s compile times after every save. I had over 300 pages and a lot of partials but it still seemed excessive. I ended up adding the following to my gulp pages task
My page now compiles in about a second or so. The only issue is when you make a change to a partial you will also need to go to the page it is being imported into and save that page as well. It's irritating but the increase in speed is worth it. |
Like I wrote, Gulp is probably the issue imo. |
Will Gulp even be needed in the future? @kball @IamManchanda @rafibomb? If the next release of Foundation only uses Webpack, I'm happy to ignore it and wait. |
@phifa please try making the following changes in your
Bumping |
Also, in FoundationPress we recently had a user switch the JS watch to use webpack's native watcher function instead of gulp and we saw a performance increase. olefredrik/FoundationPress#1169 Maybe this is something we should look into doing for Foundation to get some performance increase in the short term while we're still using gulp. |
@colin-marshall I changed the lines you suggested. I got a little speed improvement for my scss files. Not significant though. But I don't think scss is the problem. @CGTS I don't think the html files (partials, layouts, templates) are the problem. The transpile time for the html files is under 1 second. The Javascript Webpack watching is the main issue. I am working on different projects. I have just started one where I only added two jquery libraries (fancybox and mmenu) and my transpile time is already around 5s (Windows 10, SSD). @colin-marshall Why are we still using Gulp? I like the idea of completely moving to Webpack, less dependencies = less things that can cause trouble. |
Mh, what are your node and npm version? |
Node.js 8.9.2 (x64) |
I am working on a bigger project now, this is how long it takes for JS to transpile:
|
Webpack 2.7 is quite old. There is webpack 3 and 4 (beta). |
@DanielRuf yeah I tried @colin-marshall's suggestion on another project, now I also updated this project to webpack 3.10.0, not changing much. I agree, it is a big file, it includes a few libs. Why does Webpack always have to transpile all files, even the libs in node_modules? I am making minor changes in my app.js and still it builds everything from scratch.
|
@phifa I've not been part of this discussion so apologies if anything I say has been covered... |
This should be normally the case with most default rules for the js loaders. Without this webpack checks the whole node_modules directory. |
If we switched everything to webpack, would we have to use sass-loader? If so, it sounds like that will introduce its own set of performance issues. |
@conorbarclay if you have time, could you please look into switching the JS watch task here and on the Foundation Zurb Template? Thanks! |
same for me. The building process with standard "foundation watch" needs apx. 35-40seconds (standard foundation JS + ONE small JS with some scrolling events). Way too long while developing JS-Scripts IMHO |
@Geddo is this on the first time building after running |
I have completely switched a project to webpack. I will test the performance, analyze the build time and share the example setup. |
@DanielRuf so you took out gulp? anything else you had to take out? |
Yes, we completely removed gulp from one of our test setups and migrated to webpack ("webpack": "^3.10.0"). |
pure webpack (3.10.0):
And this is the dev mode. The same config with the production mode takes around 7-8 seconds (large project)
Not sure if Gulp provides any profiling.
|
So ~7s Sass in Gulp vs ~2-3s with webpack (node-sass / sass-loader). Also webpack (3) does incremental builds which is typically faster. And webpack 4 is faster than webpack 3. Especially with newer npm and Node.js versions. |
But this was just a very rough first webpack 3 migration in a very short time as we had issues with gulp on our CI servers. |
@DanielRuf that's great! I would like to see some of the other people in this issue that were having slow build times test out your setup. |
default webpack 2.7.0
|
I dont get it. So is it worth it removing gulp completely? Should we consider this for the foundation template? |
It is on my todo list. And also a switch to PostCSS in the (far) future maybe. |
We plan to fully move to webpack in an upcoming release, probably 7. |
„i don’t get it“ |
Yes, definitely. |
Just to clarify this: gulp has its own ecosystem. For example instead of directly using node-sass it uses gulp-sass which runs node-sass. Directly using it + switching to webpack 4 and PostCSS brings a huge performance improvement. |
@DanielRuf nice! How can I test it out? Do you have a prototype setup for foundation template to play with? |
@phifa I'll share an improved webpack config very soon. This were the results of an internal project which I've migrated to a full webpack setup which has some more things like a custom webpack plugin written by me (webpack port of a svg sprite plugin for gulp and Grunt). |
@DanielRuf excited to test this out! |
Will take a bit longer as I focus on the other issues at the moment, updated dependencies and a clean, working testsuite. The pure webpack build is still on my todo and has a high prio. |
You can follow the thread at #11044 Should we keep the issue here open? |
Closing as we can not reproduce such slow builds with latest build dependencies. |
What @DanielRuf is proposing, removing Gulp and using Webpack's task runner is the right way forward. It will improve the project in many ways but not in SCSS compiling time (for now): webpack-contrib/sass-loader#296 (comment) |
is awfully long. Why? Babel? Webpack? My setup is on a SSD, but in larger project the watcher needs up to a minute to transpile and reload the browser. IMHO build time should be <1s to work fast. Performance is one of the USPs of Foundation and being able to quickly develop a prototype. So, what's stopping this? Would like to hear everybody thoughts on this.
The text was updated successfully, but these errors were encountered: