You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.2 KiB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # scss-tokenizer
  2. A tokenzier for Sass' SCSS syntax
  3. ![https://travis-ci.org/sasstools/scss-tokenizer.svg?branch=master](https://img.shields.io/travis/sasstools/scss-tokenizer.svg)
  4. ![https://www.npmjs.com/package/scss-tokenizer](https://img.shields.io/npm/v/scss-tokenizer.svg)
  5. ![https://github.com/sasstools/scss-tokenizer/issues](https://img.shields.io/github/issues/sasstools/scss-tokenizer.svg)
  6. ![](https://img.shields.io/github/license/sasstools/scss-tokenizer.svg)
  7. # Install
  8. ```
  9. npm install scss-tokenizer
  10. ```
  11. # Usage
  12. ```js
  13. var scss = require('scss-tokenizer');
  14. scss.tokenize(css);
  15. ```
  16. # API
  17. ### `tokenize`
  18. Tokenizes source `css` and returns an ordered array of tokens with positional
  19. data.
  20. ```js
  21. var tokenizer = require('scss-tokenizer');
  22. var tokens = tokenize.tokenize(css);
  23. ```
  24. Arguments:
  25. * `css (string|#toString)`: String with input CSS or any object
  26. with `toString()` method, like file stream.
  27. * `opts (object) optional`: options:
  28. * `from`: the path to the source CSS file. You should always set `from`,
  29. because it is used in map generation and in syntax error messages.
  30. # Test
  31. ```
  32. npm test
  33. ```
  34. ## Attribution
  35. This project started as a fork of the [PostCSS](https://github.com/postcss/postcss) tokenizer.