Deploying with Bower

2019-08-29 05:13发布

问题:

So say I am developing with bower and I have a list of my dependencies in my bower.json file. Since I am in development mode I want to have the latest stable version of the major release I'm on.

"dependencies": {
    "jquery": "1.*"
}

In order to use these files in the client I am doing something like:

<script src="/bower_components/jquery/index.js"></script>

This is nice when developing but what happens when I want to deploy and control caching by changing the file name? For example I release my site with jquery 1.05 and develop for a while and want to release a new version. I update my jquery to 1.10 through bower but everyone that viewed my site has jquery 1.05 in their cache (the file name has not changed).

Is there tools to automate this ? Essentially I would want to update jquery and have the folder name update with the version info. And reference like:

<script src="/bower_components/jquery-1.10/index.js"></script>

I know I can do something like:

"dependencies": {
    "jquery-1.10": "1.10"
}

That would produce the desired directory structure but it isn't very automated.

标签: jquery npm bower