Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Add parameters to generated URL #439

Open
ValorLin opened this issue Sep 19, 2014 · 9 comments · May be fixed by #443
Open

Add parameters to generated URL #439

ValorLin opened this issue Sep 19, 2014 · 9 comments · May be fixed by #443

Comments

@ValorLin
Copy link

Html:

<!-- build:css common.min.css?__inline=true -->
<link rel="stylesheet" href="foo.css"/>
<link rel="stylesheet" href="bar.css"/>
<!-- endbuild -->

Expected:

<link rel="stylesheet" href="common.min.css?__inline=true"/>

Actual:

Warning: Unable to write ".tmp\concat\common.min.css?__inline=true" file (Error code: ENOENT). Use --force to continue.

I need this query string to make grunt-inline work.

@ebuildy
Copy link

ebuildy commented Sep 24, 2014

This is the path, not the url "generated".

I am not sure usemin can do that (maybe you can edit lib/fileprocessor.js file to match your needs).

Else, you can use another Grunt task who can pre or post process HTML file (maybe https://github.com/jsoverson/grunt-preprocess can match your needs?)

@ebuildy
Copy link

ebuildy commented Sep 24, 2014

https://www.npmjs.org/package/grunt-cdnify with rewrite is what are you looking for.

@ValorLin
Copy link
Author

I think ?__inline=true should be ignored when concating file.

@ebuildy
Copy link

ebuildy commented Sep 25, 2014

Of course it's ignored, "?" is invalid for a "path". You must use another grunt task for this, which is dedicated for HTML post process.

@ValorLin
Copy link
Author

In this pull request #443 , I just make a little change, and now it works fine for me.

@ebuildy
Copy link

ebuildy commented Sep 28, 2014

Not sure is the right way to achieve this. The documentation clearly says is a path, not a complete URL.

A right way to improve usemin would be to add a paramater (HTML inline or within the grunt file), something like an URL mask where we could also set a CDN , thats will ne Fan-Tas-Tic !

@ValorLin
Copy link
Author

The problem here is, common.min.css?__inline=true is a valid url , but not a valid file path. To resolve this, I convert the url into a file path by remove the query string in the url.

@stephanebachelier
Copy link
Collaborator

@ebuildy what you have in mind to set a cdn ?

@stephanebachelier
Copy link
Collaborator

Added the codereview tag as waiting for a review of #443. Not sure about this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants