devex-web-frontend / postcss-assets-rebase

Copies all assets to specified folder and rebases their paths
MIT License
21 stars 5 forks source link

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

Open khusamov opened 9 years ago

khusamov commented 9 years ago

I have a problem with file paths.

Gulp task:

gulp.task("css", function () {
    let src = ["bower_components/bootswatch/united/bootstrap.css"];
    let options = { keepStructure: true, relative: true, assetsPath: "assets" };
    gulp.src(src)
        .pipe(postcss([assetsRebase(options)], { to: "public/build/all.css" }))
        .pipe(concatCss("all.css"))
        .pipe(gulp.dest("public/build"));
});

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/united/assets/bower_components/bootswatch/fonts/glyphicons-halflings-regular.eot");
}

And here I should get the file:

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

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

cakeinpanic commented 9 years ago

Hello! thank you, seems like a bug. I'll take a look

khusamov commented 9 years ago

ок, буду очень благодарен... сам пока не смог найти ошибку... В подобном скрипте похоже аналогичная ошибка https://github.com/shutterstock/postcss-copy-assets/issues/4 потому думал, что это я что-то неправильно делаю

cakeinpanic commented 9 years ago

I really can not reproduce you case. Can you attach some test repo?

khusamov commented 9 years ago

Later, I will do.I loaded here.