Comments (8)
@jeffscottward Preflights are generally opinionated. If you'd like something different, you can disable preflight in your config, and apply your normalize styles through globalCss in your config
from panda.
Is full reset not an opinion?
Normalize is pretty industry standard. Of any preflight choices I would say it's the least opinionated and attempts to take the average of what just is already there.
If you're gonna have reset as an option, normalize should be the only other logical option.
Having only a nuclear option feels lob-sided.
Also I'm not even aware of any other "opinionated" reset options, it's generally just been one of these two. It's been around since the days of Moderinzr and jQuery.
I don't see any reason not to have it.
EDIT: Sanitize is built on top of Normalize which I suppose falls into the opinion box. I think Normalize fits a common archetype of solutions though.
https://github.com/csstools/sanitize.css
from panda.
@jeffscottward By opinionated, what I mean is that the styles applied by reset css differs by developer or design system.
As for your first question, full reset is definitely an opinion, that's why reset can be removed by setting preflight
to false in your config.
And like I suggested before, adding your normalize styles to globalCSS, puts them in the base
layer. That way you're not exactly nuking things, it results exactly as you expect.
In summary, an additional normalize
layer is not necessary for this purpose. Unless I'm misunderstanding your question
from panda.
Ok that makes but there is still an issue.
You can't simply npm install and include a normalize or reset stylesheet. You must convert it to a style object.
There is obviously a good tool to do this
https://github.com/postcss/postcss-js
But I bring it up because now you're augmenting the config and bridging between source and target. Is this more optimal than providing at least one suggested (but easily dismissible) native solution?
It's may be ok but should be called out or an example provided in docs then. Otherwise anyone who does "have an opinion" has to go searching for which transform tool among the many will work, is maintained, etc
from panda.
@jeffscottward If I understand your question correctly, you want to use raw css.
You can send css to layers in your global css file this way.
@import url("normalize.css") layer(base)
from panda.
To better understand all the requirements you wish for @jeffscottward Could you give a sample of what you hope it'll be like if there was the normalize
layer.
Where would you plugin your custom normalize?
Would it be raw css, or a style object?
Would it be in the config or css file?
This way I can give you a picture of the equivalent, and add to documentation where neccessary.
from panda.
@jeffscottward If I understand your question correctly, you want to use raw css.
You can send css to layers in your global css file this way.
@import url("normalize.css") layer(base)
Oh I didn't realize you could import to a layer with that syntax.
Huge feature, tiny explainer on mdn.
What I was after was, how do I go from npm install normalize.css sanitize.css
which both have a regular old .css
file, to including them as layers in my project.
The globalCSS
you suggested according to the docs is a style object, which would have required conversion. This just felt like a weird place to put it besides needing the conversion, and also the preflight option seems more appropriate.
My suggestion is one of these two.
The simple import you suggested.
Or
{"preflight": ['reset','normalize','sanitize']}
instead of being only true false.
Unsure why a general term of preflight would only allow you to apply a reset. Wouldn't it just be called "reset"?
from panda.
Well @jeffscottward I'd say preflight is the popular term inclusive of resets
or `normalize. Even in libraries like Chakra UI, or Tailwind.
As for using existing libraries like normalize.css or sanitize.css, I suppose the import layer syntax is the best option.
For resets in style object, It's really not weird to be in global css 😁 And you don't exactly have to define it bare there, it could come from a preset. E.g. pform-reset
from panda.
Related Issues (20)
- className + slot selector does not work when hash is true HOT 2
- Unable to get underlying raw color value when token is defined as a reference
- `Expression produces a union type that is too complex to represent` error when using `css` prop in JSX components HOT 1
- token method returns "CSS Variable" for semanticTokens while having multiple color mode HOT 1
- Recipe CSS properties are incorrectly merged with text styles
- Error with `panda cssgen` when extending built-in patterns
- `WithImportant<T>` makes TypeScript extremely slow HOT 4
- compoundVariants doens't work with config recipes
- Storybook HMR issues with recipe import + clean: true
- mask prop for a component with a slash ( mask="DD/MM") breaks panda HOT 4
- First letter of text never inherits the cursor HOT 1
- Image Data does not work HOT 1
- JSX styles disappear after either a hot reload or navigation HOT 2
- mergeConfigs esbuild warning on panda codgen (@pandacss/config) HOT 1
- CSS class is not generated if style object passed as props HOT 2
- PandaCSS' postcss dependency conflicts with vite's postcss dependency HOT 1
- Use recipe.raw within a style object / css function to generate styles
- "Conditional" is not exported by "src/styled-system/types/conditions.d.ts", imported by "src/styled-system/types/prop-type.d.ts". HOT 1
- Wrong callout for `Border Width` section HOT 1
- `jsxFramework: "preact"` includes unused `mergeCss` import HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from panda.