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

Update index.js #242

Open bonm opened 6 years ago

bonm commented 6 years ago

Usefull fix for user parametrs example <!-- build:js /js/all.js?rev=1234 -->

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.01%) to 98.16% when pulling ad578bb693a13ded89529231137d2ae373d86500 on bonm:patch-1 into c13848700f7a1194e9484aa2c95aa710030f11f4 on jonkemp:master.

jonkemp commented 6 years ago

@bonm I want to make sure I fully understand. This change just removes the url parameters from the path before passing it on?

bonm commented 6 years ago

@jonkemp yes. file can't create with param at file system

...
<head>
<!-- build:js /js/all.js?rev=@@hash -->
<script type="text/javascript" 
...
<!-- endbuild -->

</head>

gulp build
...
[13:54:23] Error: ENOENT: no such file or directory, open 'D:\project\newApp\ru\js\all_m.js?rev=@@hash'
    at Error (native)
stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^
jonkemp commented 6 years ago

Could you add a test for this?

jonkemp commented 6 years ago

Also, why would you add a parameter like that to throw it away? I think most people use something like this plugin:

https://github.com/sindresorhus/gulp-rev

bonm commented 6 years ago

I use https://github.com/bustardcelly/gulp-rev-append

bonm commented 6 years ago

@jonkemp

Could you add a test for this?

Yes, i try