Skip to content

rlaig/css-module-library

Repository files navigation

css-module-library

conventionalcommits sass css-modules css3 rollup.js PostCSS

A design system library template for css styles, fonts, colors and svg icons.

Usage

Import and use as a css-modules.

Then create your component like in this example:

React

import module from '{module-name}.module.css';

export const App = () => {
 return <div>
  <div className={`${module.style1} ${buttons.style2} ${buttons.style3}`}>
    Styled Component
  </div>
 </div>
}

Vue.js

import module from '{module-name}.module.css';

document.getElementById("app").innerHTML = `
<div>
  <div class="${module.style1} ${module.style2} ${module.style3}">
    Styled Component
  </div>
 </div>
`;

Development

Source files is structured as ff:

...
├── src
│   ├── bundle
│   │   └── index.scss
│   ├── components
│   │   ├── buttons.scss
│   │   ├── colors.scss
│   │   ├── icons.scss
│   │   ├── index.scss
│   │   ├── snackbars.scss
│   │   └── typography.scss
│   │   └── ... any other components
│   ├── constants
│   │   ├── colors.scss
│   │   ├── icons.scss
│   │   ├── index.scss
│   │   └── typography.scss
│   │   └── ... any other constants
│   ├── fonts
│   │   ├── ... all fonts
│   │   └── otherfonts.scss
│   ├── helpers
│   │   ├── helpers.scss
│   │   ├── index.scss
│   │   └── mixins.scss 
│   ├── misc
│   │   └── example.scss
│   ├── modules
│   │   ├── buttons.module.scss
│   │   ├── colors.module.scss
│   │   ├── demo.module.scss
│   │   ├── icons.module.scss
│   │   ├── snackbars.module.scss
│   │   └── typography.module.scss
│   │   └── ... any other modules
│   ├── svg
│   │   └── ... all svg icons
│   ├── App.tsx
│   ├── main.tsx
│   └── vite-env.d.ts
...

Modify and change scss files as needed and apply these on App.tsx

Install dependencies

yarn

Run development demo to preview changes

yarn dev

Run development demo to preview mdcss changes

yarn gendocs

Then, if you want to try out and see how your changes will compile, run build:

yarn build

A new folder dist and style-dist should appear and contain the compiled scss files and generated mdcss deocumentation.

About

templating for css module library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •