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

Specify base parameter #13

Closed theborakompanioni closed 3 years ago

theborakompanioni commented 9 years ago

Hey there. First off, thanks for the script - quite nice and easy to use.

I have one problem with the output directory/resulting links though. I want to change the base path to something other than the specified "temp" dir, because the resources are handled by a server side script with a different endpoint.

Example: Gruntfile.js

[...]
useref: {
  html: '<%= dirs.tmp %>/templates/**/*.html',
   temp: 'my_templates_destination'
}
[...]

a template html file

<!-- build:css /css/combined.css -->
<link rel="stylesheet" type="text/css" href="bower_components/[...]/style.css"/>
[...]
<!-- endbuild -->

Resulting file:

<link rel="stylesheet" href="/css/combined.css"/>

What I'd really want:

<link rel="stylesheet" href="/my_base_path/css/combined.css"/>

I know I can specifiy "" in the template and then copy all resources into the proper directory hierarchy - but this seems hacky and ideally the script should provide this option out of the box.

Also, I think the name "temp" is a little bit misleading since whether or not it is a temp directory depends on the way the user handles it - a better name would be "target" or "output".

I want it to use it like this:

[...]
useref: {
  html: '<%= dirs.tmp %>/templates/**/*.html',
  target: 'my_templates_destination'
  base: 'my_base_path'
}
[...]

Please let me know what you think about it.