You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.
where <type> is either js or css. If it was a good idea to limit the usemin task to one of two types, it seems like it'd be easy to detect this on the fly. References to external scripts use the <script src="">, and references to external stylesheets use <link href="">. This is enough information to determine whether the block is a js block or css block.
All of the parsing is already done for us, too. In file.js, something like:
last.type = asset[1] === 'src' ? 'js' : 'css';
would get the job done (you could set it up so that it uses, say, the first line of the block only)
With that said, I don't think it should limit you to just two types in the first place. What if you want to handle some of your scripts differently from others? One instance I can see this being useful would be source maps; you might want to generate source maps for some of your blocks, but not others.
Instead of the two-type limitation, usemin could instead allow for arbitrary types, like jsMap. For these non-standard ones, you would be required to generate the flow or it would throw an error.
If you ignore the type altogether, it could use the method I described at the beginning of this post to automatically assign the block to being js or css.
This would increase the power and flexibility of usemin a great deal, and it could easily be written to be backwards-compatible.
If I made a pull request with this feature, is there a chance it would merged?
The text was updated successfully, but these errors were encountered:
Presently, the blocks in usemin are set up like this:
where
<type>
is eitherjs
orcss
. If it was a good idea to limit the usemin task to one of two types, it seems like it'd be easy to detect this on the fly. References to external scripts use the<script src="">
, and references to external stylesheets use<link href="">
. This is enough information to determine whether the block is ajs
block orcss
block.All of the parsing is already done for us, too. In
file.js
, something like:would get the job done (you could set it up so that it uses, say, the first line of the block only)
With that said, I don't think it should limit you to just two types in the first place. What if you want to handle some of your scripts differently from others? One instance I can see this being useful would be source maps; you might want to generate source maps for some of your blocks, but not others.
Instead of the two-type limitation, usemin could instead allow for arbitrary types, like
jsMap
. For these non-standard ones, you would be required to generate the flow or it would throw an error.If you ignore the type altogether, it could use the method I described at the beginning of this post to automatically assign the block to being
js
orcss
.This would increase the power and flexibility of usemin a great deal, and it could easily be written to be backwards-compatible.
If I made a pull request with this feature, is there a chance it would merged?
The text was updated successfully, but these errors were encountered: