gulp-useref icon indicating copy to clipboard operation
gulp-useref copied to clipboard

Doesn't accept spaces in the path?

Open ranmax123 opened this issue 9 years ago • 8 comments

In my CSS path I have 'spaces'. Useref doesn't respect it.

Input:

    <!-- build:css ../Style Library/AP/CSS/AP.min.css -->
     <link href="../Style Library/AP/CSS/Tile.css" rel="stylesheet" />
     <link href="../Style Library/AP/CSS/Dropdown.css" rel="stylesheet" />
    <!-- endbuild -->

Output:

    <link rel="stylesheet" href="../Style" Library/ActionPack/CSS/ActionPack.min.css>

It breaks the reference.

Any solution?

ranmax123 avatar Nov 30 '15 09:11 ranmax123

Also, if I specify %20 instead of 'space', the library creates a folder like 'Style%20Library'.

ranmax123 avatar Nov 30 '15 09:11 ranmax123

Thanks for pointing that out. No, if neither of those works, then there are no solutions at this time.

jonkemp avatar Nov 30 '15 13:11 jonkemp

Can this be considered as a feature request?

ranmax123 avatar Dec 01 '15 06:12 ranmax123

Sure.

jonkemp avatar Dec 01 '15 14:12 jonkemp

Ok, taking a look at this, I am not planning on adding this feature at this time. The reason is the current pattern of the build block comment doesn't allow for it. Check out the useref README to see what I mean.

https://github.com/jonkemp/useref/blob/master/README.md

The top comment where it gets the build path from looks like this.

<!-- build:<type>(alternate search path) <path> <parameters> -->

The problem is that the regex looks for a space to tell where the path ends and the parameters begin. So a space in the path is a problem because the regex sees it as a stop and that is why it is not working currently.

As I do not see an easy way around this, it will not be supported until that changes somehow. Sorry for any inconvenience. Thanks.

jonkemp avatar Dec 18 '15 18:12 jonkemp

Use ; to separate

<!-- build:js; js/index.js; async -->

Or better, put the path in a string: "path"

<!-- build:js "js/index.js" async -->

manuel-di-iorio avatar Dec 20 '15 09:12 manuel-di-iorio

@manuel-di-iorio since this is the only complaint I've seen about spaces in paths, it seems to be an edge case to me. I don't want to break backwards compatibility for all users for an edge case. It's easier just to not have spaces in the path, or if that is a requirement, add tasks to copy files there then update the paths.

jonkemp avatar Dec 21 '15 16:12 jonkemp

+1 on this feature, in my case I'm trying to include some PHP into it like:

<!-- build:css <?php print $baseDir; ?>Resources/style.min.css -->

But it doesn't work, as expected.

TCB13 avatar Oct 03 '16 16:10 TCB13