fantasticon
fantasticon copied to clipboard
Create directories
Hi,
When I define pathOptions in the config file, and previously I don't create the directories it fail:
ENOENT: no such file or directory, open '.........\dist\icons-regular\icons.ttf'
There are some parameters that I need to define to allow the creation of directories? Or I always need to create the directories before run fantasticon?
Thank you all NS
For now fantasticon
expects the directories to exist - I'd rather have it fail then start creating directories recursively in your filesystem when you get some configuration wrong (just doesn't seem the safest option ;) ) make sense?
Hello, I understand your point of view, but as it is about directories / files that are not versioned, I think that fantasticon could guarantee the cleaning / creation of the necessary directories / files in the outputDir directory (and pathOptions). In my case, I have a script that is reading my fantasticon configuration file, and ensuring that the directories are cleaned / created. If you understand that it can be an asset for fantasticon to have this option, tell me and I can make a pull request
I do understand that - I need to have a proper look at how other build tools do regarding this (it's usually a mixed bag) meanwhile I'll re-open the issue.
Meanwhile, rather than writing a Node.js script, could be cleaner to have a pre
npm script with a bit of bash (that's how I usually prepare directories for build in my package.json
)
For example:
{
"scripts": {
"preicons": "rm -rf dist && mkdir -p dist && mkdir -p dist/other",
"icons": "fantasticon"
}
}
This also ensures you clean the directory every time before the icons scripts runs.
Let me know your thoughts
If it was just the outputDir directory, yes, I think as you say it is the simplest, but here the situation is really pathOptions, where we can put different paths, for example:
pathOptions: {
ttf: './dist/icons-regular/font/icons.ttf',
woff: './dist/icons-regular/font/icons.woff',
woff2: './dist/icons-regular/font/icons.woff2',
eot: './dist/icons-regular/font/icons.eot',
svg: './dist/icons-regular/font/icons.svg',
ts: './dist/icons-regular/types/icon-types.ts',
css: './dist/icons-regular/css/icons.css',
scss: './dist/icons-regular/css/icons.scss',
html: './dist/icons-regular/demo/index.html',
}
Any updates on this? Right now we solved this by adding .keep
files, it'd be really nice if these directories would be created automatically :/
"preicons": "rm -rf dist && mkdir -p dist && mkdir -p dist/other",
The issue with this is that it only works on those systems where rm -rf
and mkdir -p
exists :D - it's not only windows that will fail to run this. I think this is one of the reasons that many cli tools that write to disk abstract folder creation/deletion.
And in addition i do not want my scss file in a public directory, where the fonts are held 🤔