Closed felquis closed 5 years ago
I was using ignorePath
to ignore src/
, I removed ignorePath
and relative: true
does the work and ignored src/
path, but still with a absolute path with /
, if it is the right behave of relative
feel free to close this issue :)
My options became:
injector: {
options: {
starttag: '<!-- facebook:{{ext}} -->',
endtag: '<!-- endfacebook -->',
relative: true,
addRootSlash: false
},
browser: {
files: {
'<%= config.app %>/index.html': ['<%= config.app %>/bower_components/facebook-plugin/index.js'],
}
},
},
With this result:
<!-- facebook:js -->
<script src="bower_components/facebook-plugin/index.js"></script>
<!-- endfacebook -->
Only using relative: true the output is:
<!-- facebook:js -->
<script src="/bower_components/facebook-plugin/index.js"></script>
<!-- endfacebook -->
Only with relative: true
should do the trick based on line 30
I cannot recreate the issue. It's working for me by only setting relative: true
to get paths without a leading /
. Are you sure you're running the correct version of the plugin?
Hi guys, with this config
It should set
addRootSlash
to!options.relative
so, addRootSlash in this case should befalse
but it still compiling with absolute paths. ref https://github.com/klei/grunt-injector/blob/master/tasks/injector.js#L30So the only way to use relative paths, is to explicitly set addRootSlash to false
npm version out put