-
Notifications
You must be signed in to change notification settings - Fork 58
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
assetsPath is ignored without useHash #46
Comments
I can confirm that there is something wrong with src/styles.css @import "font-awesome"; config/styles.js var postcss = require('postcss');
var fildes = require('fildes');
var input = 'src/styles.css';
var output = 'dist/styles/main.css';
fildes.readFile(input)
.then(function(css){
return postcss([
require('postcss-import'),
require('postcss-url')({
url: 'copy',
// basePath: './',
assetsPath: 'fonts/',
useHash: true
})
])
.process(css, {
'from': input,
'to': output,
'map': {
'inline': false
}
})
})
.then(function(result){
return Promise.all([
fildes.writeFile(output, result.css),
fildes.writeFile(output + '.map', result.map)
]);
})
.catch(function(error){
console.log(error);
}); With
With |
happens here https://github.com/postcss/postcss-url/blob/master/index.js#L298...L303 Trying to figure out what this regex is supposed to do, I'm not good at understanding others Regex :( |
Got introduced here 59683e5 |
Testing my change installing |
Any updates on this? |
I can confirm too. version 8.0.0 |
Probably fixed by #146 |
nope, it's still a bug |
That PR hasn't been merged. It's still a bug after manually applying the patch? |
Yep, after applying it manually it somehow works better, but unfortunately I still get wrong paths in my monorepo project. Anyway, it seems to be a completely different story. |
Btw. I've added it manually but in a long term I have to add it somewhere as a local code in my repo or even better as a npm package. Do you guys have some speed method of adding it as a fork so that I can install my fixed version? Or maybe, there is someone who could check all pull requests and merge them? |
I do sometimes use https://github.com/ds300/patch-package |
Oh man! That's a damn good tip. I owe you a beer :) |
Hi guys, just ran into this issue today and I'd like to know if anybody figured the best option here... |
Just had also this bug. It's a big ridiculous that this is still not fixed - after 8 years. And a PR with a fix exists. Is postcss-url abandoned? |
Found some unexpected behaviour when using assetsPath.
Scenario
CSS Source: /style/css_src/index.css
Font Assets: /style/fonts/
Image Assets: /style/images/
PostCSS Generated CSS: /style/css/index.css
I am referencing my assets as such:
Using the following configuration with useHash enabled, assets are copied and hashed into /style/assets/
However using the following configuration without useHash enabled, assets are not copied anywhere
And using the following configuration without useHash, assets are copied into /style/css/fonts & /style/css/images
Just for extra reference, the following configuration will see the assets copied into /style/css/assets/fonts & /style/css/assets/images
The text was updated successfully, but these errors were encountered: