monad98
monad98

Reputation: 291

add static string to grunt usemin result src reference

Is there any way to add static string to result of grunt usemin reference?

In my case, grunt usermin replace these line

    <script src="bower_components/foo/bar.js"></script>
    <script src="bower_components/example/example.js"></script>
    <script src="scripts/bar/foo.js"></script>

To

    <script src="app/d66e52bb.app.js"></script>

But I want to add "http://cdn.foo.com/" string to src, so this is what I want.

    <script src="http://cdn.foo.com/app/d66e52bb.app.js"></script>

Should I change manually every time, or is there clever way to do this?

Thank you in advance.

Upvotes: 0

Views: 38

Answers (1)

Captain
Captain

Reputation: 677

You can use grunt-cdnify: https://www.npmjs.com/package/grunt-cdnify

cdnify: {
  someTarget: {
    options: {
      base: '//cdn.foo.com/'
    },
    files: [{
      expand: true,
      cwd: 'app',
      src: '**/*.{css,html}',
      dest: 'dist'
    }]
  }
}

Upvotes: 1

Related Questions