Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use cdnify? #441

Closed
stocksp opened this issue Aug 11, 2014 · 5 comments
Closed

how to use cdnify? #441

stocksp opened this issue Aug 11, 2014 · 5 comments
Labels

Comments

@stocksp
Copy link

stocksp commented Aug 11, 2014

I was hoping to have
"//ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"
(I''ve left off the script tags as git doesn't seem to like them)
or any cdn for angular....
placed in my dist build and the bower component not put in vendor.js.
This is not happening in 2.08.
Do I need to add the above script tag to index.html (somewhere)?
Do I need to add anything to the grunt:cdnify to get this to work?

@DaftMonk
Copy link
Member

You need leave that script tag outside of the build blocks in the index.html

@JaKXz JaKXz added the question label Aug 12, 2014
@stocksp
Copy link
Author

stocksp commented Aug 12, 2014

I've done this but the xxx.vender.js in the dist path still contains the angular.js source.
My vender.js is a pig (almost 500k) and if I run the file through
http://unminify.appspot.com/
I can see that angular.js is still there along with jquery.
The other problem I see in the network tab is that angular is now being loaded twice.
Once from the cdn and then again from the bower folder.
Very easy to see in the development build.
I just installed the 'regular' angular generator. And I get exactly the same results with the default project... I must be doing something wrong...
I'm placing the cdn script right above the build:js... scripts/vender.js comment
it sits below socket.io.

??

@DaftMonk
Copy link
Member

You can exclude the angular.js script from being injected, have a look a the exclude pattern on the bowerInstall task.

@stocksp
Copy link
Author

stocksp commented Aug 12, 2014

I was actually hoping for the oposite. I want the bower unminified code injected for development.
This works fine.
I only want the cdn minified for production.
I must be missunderstanding something as what I'm trying to do is such a standard thing.
Use a cdn for production only...
thanks for your patience.

@DaftMonk
Copy link
Member

While digging into this I spotted an issue with the cdnify task, it should look like this to correctly point to the index.html:

cdnify: {
   dist: {
     html: ['<%= yeoman.dist %>/public/*.html']
   }
 }

I pushed an update but won't be releasing a new version right away, so you'll have to update that yourself.

Once you do that, just exclude the bower dependencies as i mentioned, then manually include the bower scripts for angular and whatever other libraries outside of the build block. They should then get cdnified on build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants