-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fixed gulp build:production
does not generate unminified/unoptimized CSS/JS files.
#11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sun — make sense for me.
@colourgarden, do you want to double check before merge? 🔍
Is this change still relevant? What project do we need it for? Previous Slack discussion here. |
Yes, it's still relevant when using gulp-task-collection in an application that allows to switch asset file loading between minified/optimized and original source files through a configuration setting, such as the |
Unoptimized source files obviously cannot be loaded from assets, as they are not yet compiled in there. |
This is still needed to properly handle e.g. the SCRIPT_DEBUG constant in WordPress. The constant can be flipped at any time and the site should still load correctly when plugins and themes are requesting the minified or non-minified assets. We've started to conditionally load separate files in some projects depending on the constant already, but some of the projects are now trying to load the files from the uncompiled assets folder, which obviously cannot work if they contain e.g. SCSS instead of CSS files. A separate, non-standard build task does not make sense from my perspective, as these files should be generated by default during the regular compilation. Writing out the intermediate files before they get optimized and minified is the most sensible solution, which also does not negatively affect the build time. |
Closing this in favour of #33 |
Repeats #3 after it was reverted in 5895511
Problem
gulp build
to set up a new instance of an existing project (e.g. during a deployment process), then only minified/optimized files are generated, causing 404 errors and a broken front-end in case the application searches for unminified files.Goal
Proposed solution
Notes
Having the unminified files in production is not a problem; they're simply not used.
For
production: false
this PR causes a double write to the same file, which may be optimized in the future, but does not present a problem right now.Details
build:production
even though the necessary output was generated already.build
andbuild:production
in sequence, because both invokeclean
as first operation.