@salty-css/react 0.1.0-feat-define-import.0 → 0.1.0-feat-turbopack.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.
Files changed (2) hide show
  1. package/README.md +2 -44
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -57,7 +57,6 @@ 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)
61
60
  - [keyframes](#keyframes-animations) - create CSS keyframes animation that can be used and imported in any styling function
62
61
 
63
62
  ### Styling helpers & utility
@@ -320,49 +319,6 @@ Example usage:
320
319
  styled('div', { base: { textStyle: 'headline.large', card: '20px' } });
321
320
  ```
322
321
 
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
-
366
322
  ## Keyframes animations
367
323
 
368
324
  ```ts
@@ -452,6 +408,8 @@ And note: steps 2 & 3 are just to show how get new components up and running, st
452
408
  - **Next.js 15:** In `next.config.ts` add import for salty plugin `import { withSaltyCss } from '@salty-css/next';` and then add `withSaltyCss` to wrap your nextConfig export like so `export default withSaltyCss(nextConfig);`
453
409
  - **Next.js 14 and older:** In `next.config.js` add import for salty plugin `const { withSaltyCss } = require('@salty-css/next');` and then add `withSaltyCss` to wrap your nextConfig export like so `module.exports = withSaltyCss(nextConfig);`
454
410
 
411
+ Both Webpack and Turbopack are supported. `withSaltyCss` auto-detects which bundler Next.js is using (`next dev --turbopack` sets `process.env.TURBOPACK=1`), so no extra config is required. To force a specific bundler, pass `{ bundler: 'webpack' | 'turbopack' }` as the second argument.
412
+
455
413
  4. Make sure that `salty.config.ts` and `next.config.ts` are in the same folder!
456
414
  5. Build `saltygen` directory by running your app once or with cli `npx salty-css build [directory]`
457
415
  6. Import global styles from `saltygen/index.css` to some global css file with `@import 'insert_path_to_index_css';`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.1.0-feat-define-import.0",
3
+ "version": "0.1.0-feat-turbopack.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "dependencies": {
81
- "@salty-css/core": "^0.1.0-feat-define-import.0",
81
+ "@salty-css/core": "^0.1.0-feat-turbopack.0",
82
82
  "clsx": ">=2.x",
83
83
  "react": ">=19.x || >=18.3.x"
84
84
  },