Use free CDN hosting for netteForms.js
- Felix
- Nette Core | 1245
Hi,
I have found this free CDN hosting (jsDelivr).
It would be nice have netteForms.js in CDN.
For example:
<!-- normal -->
<script src="//cdn.jsdelivr.net/nette/2.1/js/netteForms.js"></script>
<!-- via Google Closure Compiler -->
<script src="//cdn.jsdelivr.net/nette/2.1/js/netteForms.min.js"></script>
What do you think?
- Majkl578
- Moderator | 1364
I know cdnjs:http://cdnjs.com. They let you add your library if it has more than 100 stars on GitHub.
I personally don't like the idea that much, it is an additional DNS request just to get few kilobytes of code…
- Tomáš Votruba
- Moderator | 1114
- I see advantage in easier way to keep updated, compared to composer, where I have to move the actual file.
@Majkl578: I think this is not about forcing using it, but having it in cnd in case you would like to (like Bootstrap etc.).
- Honza Marek
- Member | 1664
Tomáš Votruba wrote:
- I see advantage in easier way to keep updated, compared to composer, where I have to move the actual file.
Actually when you use WebLoader or grunt.js (and you should), you have it
updated after composer update
for free.
- petr.pavel
- Member | 535
A CDN has a positive effect only if:
- browser hits a limit for # of open connections per domain – thus a different domain counts towards a different limit and is downloaded immediately, doesn't wait for other connections to finish
- or if enough sites use the same CDN and therefore the browser already has it in its cache
Negative effects:
1] extra DNS + http(s) request (as Majkl578 pointed out)
2] security weakness – as with any CDN, you're linking to a third party
script/location and you cannot guarantee that it hasn't been compromised
- Honza Marek
- Member | 1664
Example of WebLoader config in config.neon:
webloader:
js:
default:
files:
- jquery.js
- knockout.js
- %appDir%/../libs/nette/nette/client-side/netteForms.js
- {files: "*.js", from: %appDir%/js/src}
Example of Gruntfile.js part:
grunt.initConfig({
concat: {
options: {
separator: ';'
},
dist: {
src: [
'www/libs/jquery.js',
'www/libs/knockout.js',
'libs/nette/nette/client-side/netteForms.js',
'app/js/src/**/*.js'
],
dest: 'www/generated/web.js'
}
}
});
- Tomáš Votruba
- Moderator | 1114
Thanks Honza. Do you personally prefer WebLoader or grunt? I'm currently using WebLoader and wondering about moving to grunt (concat info).
Last edited by Tomáš Votruba (2014-04-14 07:31)
- David Grudl
- Nette Core | 8228
CDN already exists http://nette.github.io/…etteForms.js
Using untrusted CDN is a huge security problem.
- Majkl578
- Moderator | 1364
GitHub.io is not a true CDN. Also, the script is not versioned.
Tomáš Votruba: English forum, so use english, not czech.
- Honza Marek
- Member | 1664
Tomáš Votruba wrote:
Thanks Honza. Do you personally prefer WebLoader or grunt? I'm currently using WebLoader and wondering about moving to grunt (concat info).
I am not sure yet. I have recently tried grunt in one project and it seems that both solution work.