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

The problem with the calculation of the path to the fonts #4

Closed
khusamov opened this issue Oct 26, 2015 · 2 comments
Closed

The problem with the calculation of the path to the fonts #4

khusamov opened this issue Oct 26, 2015 · 2 comments

Comments

@khusamov
Copy link

I have a problem with file paths.

Gulp task:

gulp.task("css", function () {
    let src = ["bower_components/bootswatch/united/bootstrap.css"];
    gulp.src(src)
        .pipe(postcss([copyAssets({ base: "public/build" })], { to: "public/build/css/all.css" }))
        .pipe(concatCss("all.css"))
        .pipe(gulp.dest("public/build/css"));
});

At the entrance to the file:

bower_components/bootswatch/united/bootstrap.css:

@font-face {
    src: url('../fonts/glyphicons-halflings-regular.eot');
}

The output is a file with an error (wrong path):

public/build/all.css:

@font-face {
    src: url("../../bootswatch/fonts/glyphicons-halflings-regular.eot");
}

And here I should get the file:

@font-face {
    src: url("../../fonts/glyphicons-halflings-regular.eot");
}

How do I configure a task so that the path to the font correctly calculated?

@alexmchardy
Copy link
Contributor

Hi @khusamov,

I'm sorry you're having problems. I created a small repo that attempts to reproduce your issue:

https://github.com/alexmchardy/copy-assets-issue-4

When I ran gulp in that repo, everything seemed to get built correctly. The built public directory looks a bit different than what you stated above however. It looks like this:

public
`-- build
    |-- css
    |   `-- all.css
    `-- fonts
        |-- glyphicons-halflings-regular.eot
        |-- glyphicons-halflings-regular.svg
        |-- glyphicons-halflings-regular.ttf
        |-- glyphicons-halflings-regular.woff
        `-- glyphicons-halflings-regular.woff2

In all.css the line you referred to above looks correct to me:

@font-face {
    src: url("../fonts/glyphicons-halflings-regular.eot");
}

Please tell me if there's something I'm missing.

@khusamov
Copy link
Author

khusamov commented Nov 6, 2015

Thank you! I will understand.

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

2 participants