Open cookch10 opened 10 years ago
Quick update to this issue. I was able to resolve it by updating grunt-usemin/lib/configwriter.js to the version from @buddhike: f966221f4d58bbcf63b4a4b2f3a6373817295ecf (see also #298) and then update my app/elements/greeting.html file as follows:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<polymer-element name="polymer-greeting" attributes="">
<template>
<style>
/* styles for the custom element itself - lowest specificity */
:host {
display: block;
}
/*
style if an ancestor has the different class
:host(.different) { }
*/
</style>
<!-- build:css(.tmp/fakedir) ../styles/elements/greeting.css -->
<link rel="stylesheet" href="../styles/elements/greeting.css">
<!-- endbuild -->
<h1>{{ greeting }}, {{ greeting }}!</h1>
<span>Update text to change the greeting.</span>
<input type="text" value="{{ greeting }}">
</template>
<script>
Polymer('polymer-greeting', {
greeting: '\'Allo'
});
</script>
</polymer-element>
I had to trick the configwriter by adding a fakedir in the alternate search path param so that it would properly resolve up one level. It's slightly hack-ish but I'm happy with it as a short-term workaround.
I think some issues cover the same thing you need.
Thanks for following up on this @stephanebachelier .
@cookch10 will come back on this issue to reference any linked issue.
Excellent :thumbsup:
I am experiencing an issue with usemin where paths are not quite working as expected. In this example, it is regarding CSS references within nested HTML files. Here is an abbreviated overview of my project directory / file structure:
+---bower_components | +---build | | index.html | | | +---elements | | greeting.html | | | +---scripts | | 73070f31.vendor.js | | b6c3df09.main.js | | | ---styles | 4e0905d0.main.css | ---elements | d9d6f0c6.greeting.css
Everything works properly for /app/index.html:
The problem occurs with the source /app/elements/greeting.html:
You'll notice that the href attribute value pointing to greeting.css in the link element is incorrect. The correct value is ../styles/elements/greeting.css, however, the only way I have been able to get usemin / rev to run successfully to completion (meaning all CSS assets get concat-ed, minified, and revved into the build directory) is to use the incorrect path.
The resulting /build/elements/greeting.html is:
This ultimately causes the final step of my build process, grunt-vulcanize, to fail. I've tried using various path combinations and even defining a custom blockReplacements type/function to add the relative path in (side note: this function would never get called, possible bug?), all to no avail. Maybe what I am trying to accomplish is not possible?
Here is my Grunt package.json:
Here's is my Gruntfile.js:
Any insight into this would be greatly appreciated.