-
Notifications
You must be signed in to change notification settings - Fork 1.4k
cdnify not doing anything. #955
Comments
Ive tried to debug it it looks like cdnify added the link to google CDN but then when the scripts are sent to 'concat', and 'uglifyjs' it look like they get downloaded from google CDN and then concated into the vendor.js file if that the case I can not see why it would need the CDN version it can just use the local version ... Please forgive me if this is how its meant to work Im new to grunt and angular and I understood the CDN would mean that the scripts are loaded from CDN at run time. |
honestly, i dont really know what cdnify is doing and it should probably be removed at some point. |
ok I've found out it is changing the link to google CDN but when the concat and minify run they download the files from the CDN instead of leaving the CDN links in place as I edited my local bower version of jQuery and when running without Cdnify I got the edited version and when running with Cdnify I got the online version in my vendor.js file. |
Is there an update to this issue? I having the same result that @apps4u is having |
I agree, I believe cdnify did nothing but wasting time in this angular-generator, unless you move |
loading angular from the cdn would be nice but not always an option. not sure what to do here. might be a flag: load Angular from Google's CDN? but that might be a bit advanced. |
Is there an instance where Angular is currently loaded from a CDN? would it be possible to added the the config or do it on the dist target? |
currently the generator doesnt load from the cdn. it should be a choice if the user wants to do it. might be better to remove the cdnify plugin and have a link on how to add it in along with support for loading angular from the cdn just to simplify things here. |
I accidentally found a workaround that seems to work. Once you've generated your app, open up app/index.html and ensure that the build scripts block (see below) is indented to the same as the vendor scripts above it, the references generated in dist/index.html is correct. Now try building again and you should see it referenced properly. I guess the build process is picky with tabs. Still not clear to me how to fix this in the generator.
Note: I was getting an error for ng-annotate, so not sure if that's related either, but if this doesn't work try running the following at your generated app root directory: npm install grunt-ng-annotate --save-dev. |
My understanding is that:
Does this sound like a desirable scenario, or a possible feature we can all agree upon? p.s. I can confirm that as of today (v 0.11.1) "grunt-google-cdn" (aka "cdnify") does absolutely nothing in the build process of "generator-angular". In fact, Bower installed modules get minified, concatenated, and injected in |
👍 for an option |
+1 to make it optional. It doesn't do anything ("version": "0.10.0") except adding extra time to cdnify files. |
Before creating this option, is there actually a way to make "cdnify" do what it is supposed to do? |
Just remove |
Isn't there a way of fixing it, changing the order of operations instead of removing some of them? Thx! |
+1 make it optional |
My solution for this issue:
cdnify: {
dist: {
html: ['<%= yeoman.app %>/*.html']
}
},
// Performs rewrites based on filerev and the useminPrepare configuration
usemin: {
html: ['<%%= yeoman.dist %>/{,*/}*.html'],
css: ['<%%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: [
'<%%= yeoman.dist %>',
'<%%= yeoman.dist %>/images',
'<%%= yeoman.dist %>/styles'
],
blockReplacements: {
js: function (block) {
var i, src, scripts = '';
for (i = 0; i < block.src.length; i++) {
src = block.src[i];
// Append scripts that aren't loaded locally (i.e., replaced by cdnify)
if (src.substring(0, 2) === '//') {
scripts += '<script src="' + src + '"></script>';
}
}
// Append the block's destination file
scripts += '<script src="' + block.dest + '"></script>';
return scripts;
}
}
}
},
Some gotchas:
|
Could we fix it in the original generator, so end users don't have to worry about complex custom configurations? |
@pensierinmusica I'm sure if you submit a PR they will review it. |
of course we will. I'd rather remove cdnify but fixing it is just as good, if not better |
+1 Thanks @wthomsen for the workaround I can submit a PR if the solution seems to be good enough |
@brunomperes I'd advocate for a pull request if it:
|
Yes, indeed. |
Still no fix for this? |
+1 for making cdnify optional in the generation process |
Is anything going on with this?
But it only has the scripts and vendor in the dist folder. |
Hi I'm new to angular and grunt . So please forgive me if Ive done something wrong . Ive created a angular app using the generator and Ive got the default grunt file only added two task one for ng-templates and one for less files. Now when I build with grunt I get a message saying the all angular files have been Cdnify but the vendor.js contains the angular.js files and weather I turn off cdnify or leave it on I get a vendor.js file of 877KB. So my understanding was the cdnify wold replace the bower local copy of angular.js files with a link to the google CDN but its tells me the all angular file have changed from bower to http google cdn but then with I look at the vendor.js file there is not link to the cdn versions of the files it concated and minify the local files can some one let me know If Im doing something wrong or that this feature is not working.
Thanks. :) :)
The text was updated successfully, but these errors were encountered: