pajtai / grunt-useref

Update references, concatenate and minify with build blocks
https://npmjs.org/package/grunt-useref
MIT License
26 stars 8 forks source link

How to integrate with CDN (Add CDN prefix to the target js file path)? #15

Open Jeff-Tian opened 8 years ago

Jeff-Tian commented 8 years ago

I have some js file and I want to serve it to my project path: /js/account-settings.xxx.js, at the same time I want to use CDN for it, say //www.cdn-xxx.com/js/account-settings.xxx.js. How can I append the cdn prefix to the build:js comment?

I tried the below code, but it generated the js file to my project path: /www.cdn-xxx.com/js/account-settings.xxx.js

<!-- build:js //www.cdn-xxx.com/js/account-settings.<%= grunt.file.readJSON('package.json').version %>.js -->
<script src="js/directives/captcha.js"></script>
<script src="js/directives/ngEnter.js"></script>
<script src="js/directives/registerForm.js"></script>
<script src="js/directives/tab.js"></script>
<script src="js/controllers/LoginCtrl.js"></script>
<script src="js/controllers/SignUpCtrl.js"></script>
<script src="js/page/account-setting/main.js"></script>
<!-- endbuild -->