Error when project path includes space
SanmayJoshi opened this issue · 5 comments
SanmayJoshi commented
Summary
PostCSS gives the below error on Windows 11, when the project path contains spaces:
POSTCSS: failed to transform "assets/css/main.css" (text/css): 'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Project structure:
Project dependency
Hugo Extended
Project path:
C:\Users\Admin\Documents\Project\My Work\Project\Main
package.json
"main": "postcss.config.js"
postcss.config.js
browserslist: [
"defaults"
],
module.exports = {
plugins: {
"@fullhuman/postcss-purgecss": {
content: ["layouts/**/*.html"],
whitelist: ["alert", "close", "collapse", "collapsing", "fade", "modal", "popover", "tooltip", "blockquote"],
whitelistPatterns: ["/alert$/", "/close$/", "/collapse$/", "/fade$/", "/modal$/", "/popover$/", "/tooltip$/", "/show/", "/alert-.*/", "/close-.*/", "/collapse-.*/", "/fade-.*/", "/modal-.*/", "/popover-.*/", "/tooltip-.*/"],
whitelistPatternsChildren: ["/alert$/", "/close$/", "/collaps$/", "/fade$/", "/modal$/", "/popover$/", "/tooltip$/", "/alert-.*/", "/close-.*/", "/collapse-.*/", "/fade-.*/", "/modal-.*/", "/popover-.*/", "/tooltip-.*/"]
},
autoprefixer: {},
cssnano: {
preset: "default"
}
},
}
Steps to reproduce the bug
- Install Hugo Extended from
https://github.com/gohugoio/hugo/releases
(I've installed it via Chocolatey if it makes any difference -choco install hugo-extended
) git clone https://gitlab.com/Softorage/softorage.gitlab.io.git
- cd into the cloned repo
npm install
- Make sure you are on Windows (I am Win 11), and that the path to the cloned repo contains spaces. Just place the cloned repo in some directory
My Work
. hugo serve -e production
RyanZim commented
What's the actual CLI command you're running?
SanmayJoshi commented
It is getting called from Hugo. I should've made that clear in the original comment. Adding 'Steps to reproduce the bug' in the original comment.
RyanZim commented
I'm guessing this is a bug with Hugo, where they're not properly quoting a path on Windows, but would have to know exactly what command Hugo is calling to confirm.
SanmayJoshi commented
I see that there is an open issue on Hugo's repo gohugoio/hugo#7333.
RyanZim commented
Yep, that looks like it.