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

CSSOptions include?: RegExp; issue #199

Closed
hroma opened this issue Mar 12, 2023 · 4 comments
Closed

CSSOptions include?: RegExp; issue #199

hroma opened this issue Mar 12, 2023 · 4 comments

Comments

@hroma
Copy link

hroma commented Mar 12, 2023

Hi,

I just need the .scss file to be exported to the output path but It doesn't work (I don't need .less, .styl, .css, etc).

Simple javascript work as expected (just to test the regex) as used in utils.ts:

const filePath = 'hello.scss';
if ((new RegExp('scss$')).test(filePath)) {
  alert('it is a scss file');
} else {
  alert('it is not a scss file, add to removeFiles array');
}

My full code:

const svgtofont = require('svgtofont');
const path = require('path');
const CSSOptions = {
    include: "scss$",
    output: 'src/css',
  };

svgtofont({
  src: path.resolve(process.cwd(), '../public/assets/icons'), // svg path
  dist: path.resolve(process.cwd(), '../public/assets/fonts'), // output path
  fontName: 'icons', // font name
  classNamePrefix: "icon",
  svgicons2svgfont: {
    fontHeight: 1000,
    normalize: true
  },
  css: CSSOptions, 
}).then(() => {
  //console.log('done!');
});
@jaywcjlove
Copy link
Owner

Are you sure there is no configuration in package.json?
@hroma

This will override your parameter configuration

svgtofont/package.json

Lines 27 to 31 in 5c514f1

"svgtofont": {
"css": {
"fontSize": "12px"
}
},

@hroma
Copy link
Author

hroma commented Mar 13, 2023

Hi,
I think the issue appear (only?) when dist (where fonts will be located) is outside the project folder...
Seems that file are placed inside the dist folder, then removed, and moved to CSSOptions:output folder where it lead to permissions errors...

So, in my case:

dist = ../public/assets/fonts' (folder outside folder)
CSSOptions:output = 'src/css' (same folder)

@jaywcjlove
Copy link
Owner

Do you want to save it in a different directory?
@hroma

If so, I recommend using a cpy-cli tool.

@hroma
Copy link
Author

hroma commented Mar 13, 2023

Thanks, cpy-cli did the trick.

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