0.1.3 • Published 7 years ago

eyeglass-sassy-data v0.1.3

Weekly downloads
43
License
MIT
Repository
github
Last release
7 years ago

Sassy Data

npm

Sassy Data is an eyeglass module which introduces functionality to import data from supported data formats to Sass maps or arrays. Currently, the supported data formats are:

  • JSON
  • YAML

Thanks to eyeglass-file-text for providing the functionality of reading files.

Installing

npm install --save eyeglass-sassy-data

# or

yarn add eyeglass-sassy-data

Then in your Sass files:

@import "sassy-data";

API

  • read-file($filePath, $encoding: $sd-default-encoding) - Read the text of a file into a Sass string
  • json-to-map($jsonAsString) - Convert a string containing JSON into a Sass map/array
  • yaml-to-map($yamlAsString) - Convert a string containing YAML into a Sass map/array
  • import-json($filePath, $encoding: $sd-default-encoding) - Read a JSON file and transform the contents into a Sass map/array
  • import-yaml($filePath, $encoding: $sd-default-encoding) - Read a YAML file and transform the contents into a Sass map/array

Notes

  • The default encoding for all files read can be set by overriding the $sd-default-encoding variable; the default is set to UTF-8. This encoding can be changed on a per-file basis by passing a value for the $encoding parameter in the function calls
  • The file paths given should be relative to the Sass file calling the function (this does not mean the location of the Sassy Data function definitions)

License

MIT

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago