angularjs - grunt change location-specific urls in javascript -


i'm brand new grunt. i'm wondering if there's way, while grunt compiles .js single file, change location-specific urls (like production , dev endpoints).

i've came across grunt when began using ng-boilerplate build angular project. i've noticed in index.html, grunt inserts specific .js file in header using:

<script type="text/javascript" src="assets/<%= grunt.config.get('pkg.name') %>.js"></script> 

but, when followed pattern in .js file, set variable var url = '<%= grunt.config.get('pkg.url') %>', not awarded similar insertion (after updated package.json house url field.

is there way insertion on javascript files, or trying impossible?

you use grunt-string-replace.

from docs:

replaces strings on files using string or regex patterns. attempts string.prototype.replace adapter task grunt project.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -