Skip to content

Experimental: Extract css from *.style.js files

Notifications You must be signed in to change notification settings

jim-fung/styled.css

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Extract css from *.style.js files

 

install

yarn add @ds-tools/styled.css --dev

 

usage

Add it to your package.json

{
  "scripts": {
    "css": "styled.css --theme src/theme/theme.js"
  }
}

 

input:

*.styles.js authored for a system-ui theme spec.

/* form.styles.js */
export const styles = {
  Form: {
    margin: "auto",
    boxShadow: "shallow",
    paddingY: 4
  },
  FormLabel: {
    color: "grays.800",
    fontSize: 2,
    marginBottom: 1
  }
};

output:

/* styles.css */

.form {
  margin: auto;
  box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
  padding-top: 32px;
  padding-bottom: 32px;
}
.form--label {
  color: #404b5a;
  font-size: 16px;
  margin-bottom: 4px;
}

See /example folder for full example

 

license

MIT © siddharthkp

About

Experimental: Extract css from *.style.js files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 96.3%
  • CSS 3.7%