Closed seanogdev closed 8 years ago
Hey @miralize. I'm glad you're finding this useful.
I have considered adding the base path to the plugin settings myself, so will make sure this is included in the next release, which should drop in the next week or so.
I'll have a think about the manifest location via config file recommendation...
@miralize - I've pretty much got this update ready to release now.
There will be a new field in the plugin settings called 'Asset Base Path'. This is optional, so if it's left blank the rev function will just spit out the rev'd filename as it does currently.
You can use any environment variables that you have set in config/general.php
in this field. So, if you have something like the following in your general.php
file:
'*' => array(
'environmentVariables' => array(
'baseUrl' => 'http://clubstudio.co.uk/'
),
)
you can set the Asset Base Path field to {baseUrl}assets/
, which would cause rev('css/style.css')
to expand to http://clubstudio.co.uk/assets/css/style.css
.
I've noticed that your example seems to suggest that you'd like the original path of the asset to be overwritten by the plugin - css/style.css
becomes assets/style.css
. Is that correct, or a typo?
I'm happy to prepend a string to the path but I don't really want to have the plugin pull the filename from the path passed in and then prepend to that. I'm open to changing my mind if there's a good argument for doing that though :+1:
Let me know if that's all cool and if it will actually do what you wanted :grimacing:
Nice work Scott!
Yes, My example was wrong , it should be assets/css/style.css
. No need to overwrite anything, no need imo!
One minor request / addition would be to let the assetPath be configurable in general.php
to save the db calls it would require to get the assetPath from the plugin settings. For example, on some pages I have 7-8 revved assets on a page, thats 7 db calls extra required,
@miralize, I've just pushed an update to the develop
branch for v3.0.0.
All configuration is now file-based. The more I thought about it, the more it made sense to remove the configuration from the database. If you're using this plugin it's likely that file-based config isn't going to be a frustration :smile:
I've also removed the option to pass a custom manifest path as a second argument.
Feel free to install the latest from the develop
branch. If all is well I'll merge to master and tag a new release.
:+1:
Thanks so much for this, testing out and its perfect. The only thing I'm not a huge fan of is the custom config file. I'd prefer to lump it all in the general.php file but I understand why you went that way.
Very nice work!
Cool! Thanks for testing it out - glad it all works as expected. It's all merged and tagged now :smile:
I did consider allowing for the config in general.php, but for now I'm happier for it to have it's own config :+1:
Thanks again @miralize.
Yeah exactly, its just my inherent laziness of having to write out all ~6 of my different envs again :) Asset Rev v3 already in production :)
First of all, thanks a million for building this, I just converted my site to using my generated rev-manifest using your plugin in about 15 minutes after putting it off for about 6 months :)
My question is would it be possible to have a plugin setting set a base asset path so that instead of having
{{ assetUrl ~ rev('css/live.css') }}
everywhere on my site, where assetUrl is a variable that I just set tositeUrl ~ 'assets'
, I could just write the followingAlso a follow up question is would it be possible to allow a file config option for setting the rev-manfiest location in general.php, thats less of an issue but I do see it as more of a dev configuration than a setting that a client potentially has access to.