-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Extending the build script functionality #831
Comments
how about data attributes? <script data-build="libs.js" src="jquery.min.js">
<script data-build="libs.js" src="underscore.min.js">
<script data-build="libs.js" src="backbone.min.js">
<script data-build="app.js" src="plugins.js">
<script data-build="app.js" src="script.js"> I like it though. Very self describing. Would be nice to avoid an external YAML config file maybe potentially. (at the same time i'm reading more about AMD modules and require.js and feeling sexy on those) |
@mklabs has been playing around with these ideas here: https://github.com/mklabs/h5bp-build-script-tags/ |
Some inputs: Here is what using this kind of build script system would look like:
In both cases, it feels really good using it. Changing the "bundles", their location, their content is a matter of tweaking the index.html files (possibly work on multiple html files). Both approaches are valid, and both are very pleasant to work with. |
Awesome. Some questions.
|
Basically, the build script output stuff based on the current working directory. The current implementation does by outputting stuff in
Note that this is close to the behavior of the html comments approach, where the last part of |
Sorry, my fault, I meant how does it know where to insert the generated file in the HTML source. |
Well, this is slightly different for both approach:
|
Thanks :) |
Moved to h5bp/ant-build-script#4 and mklabs/node-build-script#1 |
Just sharing an idea about how the build script might be adapted to move some of the configuration into the HTML, and maybe make it more flexible and accessible to front-enders at the same time. It might be a bit ridiculous but here goes...
Pretty much every build script I've had to work with involved listing the files to be minified/concatenated in groups in a configuration file, sometimes that name and location of the output file was included there too. Then a line of server-side code is placed in the template to mark where the generated file should be output in the HTML source in the production environment.
The JS concatenation stuff is sort of like that but hard-coded and limited. Maybe we could expand upon it and make the comments more obviously related to the build script and exist in discrete blocks. An idea I discussed with @mklabs was to have some sort of "build script tag" in the HTML comment. For example:
Everything inside a "build block" would be minified, concatenated, and revved into the '[md5].site.css' filename based on the one that is specified in the comment. You could use whatever name you want. And anything @import-ed inside those stylesheets would be included too.
The 'css' part would be a label to attach specific customisations made from within the config file like the compression library used and the output directory. So 'css' might specify to use YUI's compressor and output to
/publish/css/site.css
. You might just have 1 for CSS and 1 for JS, or maintain several different patterns.Not sure how things would be handled if your moved the files around relative to each other (e.g. the image paths in the CSS), or how the check would work to make sure you weren't rebuilding unchanged files.
Anyway, that's it.
The text was updated successfully, but these errors were encountered: