@salty-css/eslint-config-core 0.1.0-alpha.9 → 0.1.0-feat-define-import.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -57,6 +57,7 @@ To get help with problems, [Join Salty CSS Discord server](https://discord.gg/R6
|
|
|
57
57
|
- [defineVariables](#variables) - create CSS variables (tokens) that can be used in any styling function
|
|
58
58
|
- [defineMediaQuery](#media-queries) - create CSS media queries and use them in any styling function
|
|
59
59
|
- [defineTemplates](#templates) - create reusable templates that can be applied when same styles are used over and over again
|
|
60
|
+
- [defineImport](#importing-additional-css) - pull in external CSS files (relative, public, node_modules, or URL)
|
|
60
61
|
- [keyframes](#keyframes-animations) - create CSS keyframes animation that can be used and imported in any styling function
|
|
61
62
|
|
|
62
63
|
### Styling helpers & utility
|
|
@@ -319,6 +320,49 @@ Example usage:
|
|
|
319
320
|
styled('div', { base: { textStyle: 'headline.large', card: '20px' } });
|
|
320
321
|
```
|
|
321
322
|
|
|
323
|
+
## Importing additional CSS
|
|
324
|
+
|
|
325
|
+
Use `defineImport` to pull in CSS that lives outside of Salty's authoring API — a reset stylesheet from npm, a Google Fonts URL, an asset in your app's `public/` folder, or a sibling `.css` file. The compiler turns each spec into an `@import` rule in the generated `saltygen/index.css`, so the imported stylesheets travel with the rest of your build.
|
|
326
|
+
|
|
327
|
+
```ts
|
|
328
|
+
// /styles/imports.css.ts
|
|
329
|
+
import { defineImport } from '@salty-css/core/factories';
|
|
330
|
+
|
|
331
|
+
export default defineImport(
|
|
332
|
+
// Relative to this file
|
|
333
|
+
'./reset.css',
|
|
334
|
+
// From node_modules (bare specifier — same as Vite / native CSS @import)
|
|
335
|
+
'modern-normalize/modern-normalize.css',
|
|
336
|
+
// From node_modules (~ prefix — same resolver, webpack-style)
|
|
337
|
+
'~normalize.css/normalize.css',
|
|
338
|
+
// From your app's public/ folder (served at the host root)
|
|
339
|
+
'/fonts/inter.css',
|
|
340
|
+
// External URL
|
|
341
|
+
'https://fonts.googleapis.com/css2?family=Inter&display=swap',
|
|
342
|
+
// Object form — attach media or supports() conditions
|
|
343
|
+
{ url: './print.css', media: 'print' },
|
|
344
|
+
{ url: './p3.css', supports: 'color(display-p3 1 1 1)' }
|
|
345
|
+
);
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Path resolution:
|
|
349
|
+
|
|
350
|
+
| Pattern | Behaviour |
|
|
351
|
+
| --------------------------- | ---------------------------------------------------------------------------------------- |
|
|
352
|
+
| `http://`, `https://`, `//` | Emitted verbatim |
|
|
353
|
+
| Starts with `/` | Public-folder URL — emitted verbatim, the browser resolves it against your host |
|
|
354
|
+
| Starts with `./` or `../` | Resolved at build time relative to the file that called `defineImport` |
|
|
355
|
+
| `~package/file.css` | Stripped of the leading `~`, then resolved from `node_modules` and copied into the build |
|
|
356
|
+
| `package/file.css` (bare) | Same `node_modules` resolution as the `~` form |
|
|
357
|
+
|
|
358
|
+
All imports are placed inside a new `imports` cascade layer that sits **before** `reset`, `global`, `templates`, and your component styles. This means your own styles always win over third-party CSS you pull in — which is what most teams expect when they drop in something like `modern-normalize`.
|
|
359
|
+
|
|
360
|
+
The full layer order in the generated `index.css` is:
|
|
361
|
+
|
|
362
|
+
```css
|
|
363
|
+
@layer imports, reset, global, templates, l0, l1, l2, l3, l4, l5, l6, l7, l8;
|
|
364
|
+
```
|
|
365
|
+
|
|
322
366
|
## Keyframes animations
|
|
323
367
|
|
|
324
368
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salty-css/eslint-config-core",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-feat-define-import.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@salty-css/core": "^0.1.0-
|
|
42
|
-
"@salty-css/eslint-plugin-core": "^0.1.0-
|
|
41
|
+
"@salty-css/core": "^0.1.0-feat-define-import.0",
|
|
42
|
+
"@salty-css/eslint-plugin-core": "^0.1.0-feat-define-import.0",
|
|
43
43
|
"eslint": ">=9.x || >=8.x || >=7.x"
|
|
44
44
|
}
|
|
45
45
|
}
|