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

noconcat: true replace the script and link tag #126

Closed arizqi13 closed 8 years ago

arizqi13 commented 9 years ago

I would like to control the concatenation of my scripts and css files through a variable like so: { noconcat: options.debug } However, even with the noconcat set to true, the html file is still get compacted. I even tried the provided example, but setting noconcat to true:

    var assets = useref.assets({noconcat: true});

Both the scripts and the css are just being copied straight, as expected, resulting the structure:

|-- dist
|     |-- css
|     |    |-- one.css
|     |    |-- two.css
|     |-- scripts
|          |-- one.js
|          |-- two.js
|     |-- index.html
|-- css
|     |-- one.css
|     |-- two.css
|-- scripts
|     |-- one.js
|     |-- two.js
|-- index.html

But then the resultant dist/index.html is:

<head>
    <link rel="stylesheet" href="css/combined.css">
</head>
<body>
    <script src="scripts/combined.js"></script>
</body>

which ... doesn't make sense.

I don't know if that is intended, but I would expect the html file to not be modified. Because now then the page will complain about combined.js and combined.css being not found.

jonkemp commented 8 years ago

This would involve a pull request to the https://github.com/digisfera/useref module which would pass the option there and then bypass the tag updating.

jonkemp commented 8 years ago

Closing. This should work as expected now with the latest versions of useref and gulp-useref.