master-co / css

The CSS Language and Framework
https://css.master.co
MIT License
1.82k stars 41 forks source link

💖 MasterCSS should look for `master.css.*` config file inside src folder (svelte) #309

Closed oskar-gmerek closed 1 year ago

oskar-gmerek commented 1 year ago

Current

Currently masterCSS and all masterCSS tools are looking for configuration file (master.css.ts) in the main folder of project. This is usual place for config files, but because we importing that config, that create a problem in vite context. Vite autodetects a root of project (which is src folder in the svelte context) and limiting importing files to this folder, deny all imports below it and throwing error:

The request url "/project/master.css.ts" is outside of Vite serving allow list.

masterCSS (and tools) looks for master.css.ts in:

/master.css.ts 
/src/

Above will fulfill a masterCSS side, but will throw error about importing file outside of allow list of Vite.

Expected

masterCSS (and tools) should looks for master.css.ts in:

/
/src/master.css.ts

This will be inside allow list of Vite, but currently is not detected by masterCSS (and tools). This is also the place from where master.css.ts is imported in the guides of integration of masterCSS with Svelte and is leading to many errors just after following a guide.

npx mcss init should also detect sveltekit, and create config file in src folder.

Probably the best for DX will be:

All above is in context of SvelteKit, but I believe there is more cases where above apply.

1aron commented 1 year ago

Adding one more step for setting up the allow list causes fewer side effects.

Screenshot 2023-11-14 at 5 06 18 PM

The main reason for placing master.css.* in the root directory is that Language Service and ESLint Plugin grab configuration files from the root directory by default. Once the file location of master.css.* changes, you will have to pay more attention and manually specify the configuration of both.

Screenshot 2023-11-14 at 4 30 10 PM
1aron commented 1 year ago

@oskar-gmerek Thx for your report! The documentation has been updated https://beta.css.master.co/docs/installation/svelte

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 2.0.0-beta.204 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 10 months ago

:tada: This issue has been resolved in version 2.0.0-rc.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: