btford / grunt-google-cdn

58 stars 50 forks source link

Add "componentsPath" option #59

Open whyleee opened 9 years ago

whyleee commented 9 years ago

There is a common situation when the path to "bower_components" dir is "scripts/bower_components"or similar. And for some reason there is a code to strip leading path segment off, based on assumption that entire app will be one level down after "bower.json". But this is not true for a lot of projects (and moreover, this code doesn't work in Windows #39).

Supposing i have "scripts/bower_components" path and this script tag in html: <script src="/scripts/bower_components/jquery/dist/jquery.js"></script> it will be replaced by the next tag after build: <script src="/scripts//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> which is naturally wrong and should be: <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Please do not depend on project structure, but add an option to set "bower_components" path manually. This is easy, because google-cdn already has this option.

kynan commented 8 years ago

This should also respect the cwd setting in .bowerrc, see #36