https://github.com/jsit/sassdoc-to-snippets
Chew up a file or directory of SassDoc-commented Sass, spit out snippets
https://github.com/jsit/sassdoc-to-snippets
sassdoc snippets snippets-editor
Last synced: 4 months ago
JSON representation
Chew up a file or directory of SassDoc-commented Sass, spit out snippets
- Host: GitHub
- URL: https://github.com/jsit/sassdoc-to-snippets
- Owner: jsit
- Created: 2022-10-27T13:17:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T00:19:30.000Z (over 3 years ago)
- Last Synced: 2025-10-19T18:41:40.875Z (8 months ago)
- Topics: sassdoc, snippets, snippets-editor
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/sassdoc-to-snippets
- Size: 126 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SassDoc to Snippets
Convert [SassDoc](http://sassdoc.com)-commented Sass to snippets files.
Ignores `private`ly-scoped mixins/functions/variables.
Can be used in Gulp et al.
## Usage
```sh
sassdoc-to-snippets ./scss/ -f vscode -o ./scss.json
```
(requires trailing slash for directories)
## Gulp
```javascript
const sassdocToSnippets = require('sassdoc-to-snippets');
gulp.task('sassdoc-to-snippets', function() {
return sassdocToSnippets({
src: './stylesheets/scss/',
dest: './snippets/scss.json',
})
});
```
### Flags
- `-o filename`: Output to `filename`
- `-f format`: Render snippets in `format` format
- `-p prefix`: Prefix snippet expansions with `prefix` (for when you're
namespacing with [Sass modules](https://sass-lang.com/documentation/at-rules/use))
- `--debug`: Output the processed SassDoc data as well as the resulting snippets
## Example
### Input
```scss
/// Add padding around an element
///
/// @param {String} $value
@mixin add-padding($value) {
padding: $value;
}
```
### Output
#### [VSCode](https://code.visualstudio.com/docs/editor/userdefinedsnippets)
```json
{
"add-padding": {
"prefix": "add-padding",
"description": "Add padding around an element",
"body": [
"add-padding(${1:$value})"
]
}
}
```
#### [Neosnippet](https://github.com/Shougo/neosnippet.vim) (Vim)
```neosnippet
snippet add-padding
abbr Add padding around an element
add-padding(${1:$value})
```
## Contributing
Edit in `src`, run `npm run build` to compile.
Know of a snippet syntax for some other editor? Please file an Issue or PR!