OverZealous / cdnizer

Node module for replacing local links with CDN links, includes fallbacks and customization
MIT License
52 stars 24 forks source link

Replacing with the wrong files #16

Closed pencilcheck closed 6 years ago

pencilcheck commented 9 years ago

Some angular files are replaced with the wrong cdn files:

bower_components/angular-sanitize/angular-sanitize.js bower_components/angular-messages/angular-messages.js are being replaced with angular.min.js

when I use 'google:angular' in the options or 'jsdelivr:angularjs' the following files:

bower_components/angular-sanitize/angular-sanitize.js bower_components/angular-messages/angular-messages.js bower_components/angular-material/angular-material.js will be replaced with angular.min.js

OverZealous commented 9 years ago

I have no idea. That is not enough information for me to understand what's going on. Try to create a minimal test-case that replicates the issue and provide all the code involved (it should only require a couple lines of gulp and few lines of HTML).

pencilcheck commented 9 years ago

https://github.com/pencilcheck/cdnizer-test-case

Here is a minimal test case, a scaffold from yeoman using gulp build system, angular and angular material.

If you do a git pull and run bower install and npm install on the root project root. Then run gulp watch then C-c to stop the process, open the index.html under .tmp/serve/ folder, you should notice that some angular script tags are being replaced with the cdnizer with the problem described above.

If you want to play with cdnizer, go to gulp/inject.js at around line 32

The project is using gulp-cdnizer for the gulp integration btw.

OverZealous commented 9 years ago

I'm sorry, that is not a minimal test case. A minimal case should have at most 3 files: gulpfile.js, package.json, and index.html.

I really don't have the time to go through an entire scaffolded application to understand what's going on.

pencilcheck commented 9 years ago

https://github.com/pencilcheck/cdnizer-test-case

OK, I have help you to remove all unnecessary files. I have tried very hard to make it as minimal as possible, now there is only gulpfile.js and simple package.json and bower.json left. Just run npm install then bower install then run gulp to produce a index.html in the root folder that has the problem.

OverZealous commented 9 years ago

OK, it turns out it's related to the allowRev property, which is by default set to true. Just change your config to be something like this to fix the issue:

{
    allowRev: false,
    files: [ 'google:angular' ]
}

It's probably something that needs to be corrected, but it would be a breaking change, and I don't have the time to fix it at this moment.

pencilcheck commented 9 years ago

What does allowRev do?

OverZealous commented 9 years ago

https://github.com/OverZealous/cdnizer#optionsallowrev

OverZealous commented 6 years ago

Version 2.0 changes the default behavior moving forward, so allowRev defaults to false.