0.0.2 • Published 4 years ago

@mhombach/usp v0.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

usp - Universal Styleinformation Publisher

The purpose of this package is to make styleguide-values available in different formats.

Usage:

  • Create your own GIT repository or NPM-package (private or public)
  • Create a (flat) JSON-file that contains all style-values that you want to define

Example:

{
    "font-size-small": "12px",
    "font-size-medium": "16px",
    "font-size-large": "22px",

    "font-color-primary": "blue",
    "font-color-secondary": "purple",

    "space-small": "2px",
    "space-medium": "4px",
    "space-large": "10px"   
}

Example folder-structure:

/json
    styles.json
publish.js
  • Install package (npm install @mhombach/usp --save)

Example-code in publish.js:

const usp = require('@mhombach/usp')
const data = require('./json/styles.json');

usp(data, './styles');

If you want automatic updates on the style-files i suggest you use the prepublishOnly script in your package.json. Something like...:

"prepublishOnly": "node publish.js"

Execution of publish.js will create the following folder/files:

/styles
    variables.css
    variables.less
    variables.scss
    variables.styl

Each style-file get's a comment-line on top with the date it was created (this could be made configurable in the future of this package).

If you have any question, feel free to ask by submitting an issue on Github.