grunt-assemble
grunt-assemble copied to clipboard
assets path malfunction
Steps to reproduce:
-
Add CSS file to
app/styles/main.css
-
Create
index.hbs
with:<!-- build:css(.tmp) {{assets}}styles/main.css --> <link rel="stylesheet" href="{{assets}}styles/main.css" type="text/css" media="all"> <!-- endbuild -->
-
Create Gruntfile with path of
assets
anddest
set toapp/
-
Compile
What happens: index.html comes across with
<!-- build:css(.tmp) ..styles/main.css -->
<link rel="stylesheet" href="..styles/main.css" type="text/css" media="all">
<!-- endbuild -->
What should happen: valid relative path, e.g. styles/main.css
or ./styles/main.css
.
@ain Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
You're missing a slash in your template after {{assets}}
@jonschlinkert I'm calling to reopen this ticket. As described, the configuration had the slash:
assemble: {
options: {
flatten: true,
layoutext: '.hbs',
assets: './app/'
}
}
What it gives me is:
<script src="..scripts/vendor.js"></script>
Also, if I move slash from the config to the template, it gives me
<script src="../scripts/vendor.js"></script>
but it should be
<script src="./scripts/vendor.js"></script>
So the assets path calculation is certainly invalid here.
I was able to resolve the issue by duplicating the assets path!
assets: '<%= config.app %>/<%= config.app %>'
This pretty much reproduces the issue. I'm reopening the ticket.
We can look into this, but it seems more likely that something is wrong in your config or templates, otherwise we would have gotten other issues about this by now.
Or maybe there is a bug with some combination of things that isn't common?
Can you provide the minimum necessary setup for us to reproduce the bug?