jonkemp / gulp-useref

Parse build blocks in HTML files to replace references to non-optimized scripts or stylesheets.
MIT License
705 stars 93 forks source link

Use with Twig (or other templating language) #196

Closed simonswiss closed 8 years ago

simonswiss commented 8 years ago

Hi!

Trying to use gulp-useref inside Twig templates. to work across multiple environment, I need to use a template tag inside the path of the output file like so:

<!-- build:css {{siteUrl}}assets/css/bundle.css -->
<link rel='stylesheet' href='{{siteUrl}}assets/css/main.css'>
<link rel='stylesheet' href='{{siteUrl}}assets/css/page.css'>
<!-- endbuild -->

This compiles to the ouput I want:

<link rel='stylesheet' href='{{siteUrl}}assets/css/bundle.css'>

but the bundle.css file gets created inside a {{siteUrl}}assets/css/ folder. I understand why, but I couldn't find a workaround. Is there a way to pass another file destination, so I can keep the same HTML (Twig) output but have the file go in the proper destination - /assets/css/bundle.js ?

Thanks in advance for your pointers! :)

simonswiss commented 8 years ago

Looks like a duplicate of #175 - sorry for posting here.