Closed cmalven closed 7 years ago
I'm not terribly concerned with making the rev conditional. Even if the platform doesn't have a plugin to deal with revved assets it's really simple to write a quick function that does the same thing. Plus the project's integration guide provides a few options of how to implement it.
@brianjhanson I'd agree with you if the rev-manifest.json
wasn't in the craft
directory, which you mentioned in a previous pr. Right now, the rev
task will create a file at craft/rev-manifest.json
even if the project isn't using Craft, which is obviously weird.
Yeah, that's true. I feel like we should get the split between craft / non-craft projects in here pretty soon. Or just assume every project is Craft for now (because they almost always are)
@brianjhanson the PR you just merged (#30) already introduced a split in this file between Craft and non-craft projects, so we should be good to start doing that whenever we want.
Maybe as a part of this PR I should go ahead and make the update to store rev-manifest.json
in a non-craft place. Doesn't seem like it should be a difficult change.
@brianjhanson updated this to do the following:
rev-manifest.json
out of the craft
directory.
Closes #27
Revving is important for production to allow us to heavily cache js + css, but during development revving after every file change means that the changes take a bit longer to show up. This modifies things so that revving of assets only happens during the gulp
build
task, and never locally. Because therev-manifest.json
gets cleared on every file change, plugins (like Craft'sassetrev
) will fall back to using the original, non-revved asset during production.After #30 gets merged, we may want to conditionally include the
rev
task based on whether we're using Craft or not, since it relies pretty heavily on having an established workflow for using the revved assets, which as far as I know we don't have for any other platform.Note: If its not clear to everyone what "revving" is to begin with, it's the practice of adding a semi-random string of characters to the end of the filename for css, js, images, or other static assets so that you can tell the browser to cache them for a really long time, but still have the cache bust immediately when the file changes. For instance,
main.css
becomesmain-72067e9aa6.css