Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stylesheet Path Issues #36

Open
markadrake opened this issue May 19, 2016 · 3 comments
Open

Stylesheet Path Issues #36

markadrake opened this issue May 19, 2016 · 3 comments

Comments

@markadrake
Copy link

My gulp src begins with:

dist/**/*.html

My stylesheet has the following path:

/css/app.css

I call InlineCSS:

    .pipe($.inlineCss, {
      applyStyleTags: false,
      removeStyleTags: false,
      removeLinkTags: true,
    })

I get errors trying to access the CSS file.

The results are pretty funky.

Path to Stylesheet InlineCSS Tries to find
/css/app.css dist/[folder-path]/css/app.css
/dist/css/app.css dist/dist/css/app.css
../css/app.css /css/app.css

How is InlineCSS determining the path to my CSS file? Sometimes it wants to pull the directory structure in from the asterisks (first example) other times it completely ignores the path (second and third example) and going up one directory takes you completely out of the dist folder all together (third example).

Is there no way to tell InlineCSS that dist is the root of my site?

I see an options.url available - placing anything here has been unsuccessful. It's definitely not liking strings, it seems to try and access my localhost when I provide anything here. And my site is not running, because the build is not complete.

@jonkemp
Copy link
Owner

jonkemp commented May 20, 2016

Can you post your gulp task? And can you provide the stack traces?

@slavafomin
Copy link

slavafomin commented Jun 26, 2016

Hello!

I'm having exactly the same issue. I want to specify the base path from which all stylesheet files should be resolved. Because I have nested HTML files and I want to specify absolute path to CSS from them.

@slavafomin
Copy link

slavafomin commented Jun 26, 2016

Wow, I've managed to resolve the issue after looking in this module's source code.

I've specified the base path the following way:

    .pipe(gulpInlineCss({
      url: 'file://' + __dirname + '/dist/',
      // ...
    }))

I would recommend to update the documentation for url parameter, because right now it is incomplete. I would have never guessed to use file:// prefix.

Thank you!

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

No branches or pull requests

3 participants