jingo-minify
jingo-minify copied to clipboard
Change bundle path and fix relative URL's
Feel free to say: "THESE ARE USELESS CHANGES AND NOBODY NEEDS THEM!".
This does a couple of things:
- CSS bundles will now be in ~~MEDIA_PATH/bundled/css~~
MEDIA_PATH/BUNDLES_DIR/css
- JS bundles will now be in ~~MEDIA_PATH/bundled/js~~
MEDIA_PATH/BUNDLES_DIR/js
- Relative URL's in CSS will now be fixed to point to the correct URL when bundled. (This was a problem on SUMO and recently on Input)
r?
I should also probably point out the reason for bundling to the bundled
folder.
I happened to have a bundle called jquery
and sadly one of the files in the bundle was jquery-min.js
which (you guessed it) got replaced with the bundle file.
Now admittedly, this is a silly edge case that would normally not be an issue, and is pretty easy to get around. But I generally like the idea of tossing bundled files in another folder because it also keeps file clutter down in my js/css folders.
If someone updates to this, will they be hosed? Are there things they need to do to update to this version?
@willkg with the new change to the default value of BUNDLES_DIR
there should be no compatibility issues.
Test added ^
And now tests pass ^
If this is all good I'll squash and push
@cvan any outstanding comments here? @rehandalal Still want to get this merged in?
I can't understand why there is the /bundled/
path still hard-coded in some places given that there is a setting for that path.
I just did the following:
- Rebased/squashed the original commits in this pull request and fixed all the conflicts
- Updated the tests to be more thorough
I still think this is pretty useful!
r?
@jsocol think you could have a quick look-see at this? THANKS!
I can but not for another day or so, and I don't have the context that @cvan would
looking good. sorry it's taken so long to get this in. I don't think we've understood the use case here, hence the delays.
I'll clean up the code.
For me, this is why I made the changes:
- Having a special directory that bundles get stored in makes it easier for me to filter those files out through .gitignore. I also had one edge case where I had a file which shared the same name as the final minified bundle that it belonged to which caused a whole mess. Admittedly that's easily fixed by renaming the file or the bundle but I prefer this.
- Fixing the relative URLs helps when you're bundling files that are installed by bower and they have additional image assets that are linked to such as FancyBox. Without this, sometimes I have to copy these image files into the
css
folder or other places and that was just getting messy.
@cvan fixed based on feedback ^