Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
SassDoc. Like JSDoc, but for Sass files.
// Function description
// ... on several lines if you will
// ---
// @access private
// ---
// @alias other-function
// ---
// @requires dependency-function
// ---
// @param {*} $parameter-name - description of the parameter
// @param {String} $other-parameter (default) - parameter with a default value
// @param {ArgList} $args - extra parameters
// ---
// @throws `$other-parameter` must be a string.
// ---
// @return {String | Null} description of the returned value
@function dummy-function($parameter-name, $other-parameter: 'default', $args...) {
// ...
}
Note: it works exactly the same with mixins.
npm install -g sassdoc
sassdoc <src> <dest> [options]
<src>
Path to your Sass folder.<dest>
Path to the destination folder.-h, --help
: bring help-v, --verbose
: run in verbose modevar sassdoc = require('sassdoc');
sassdoc.parse(__dirname + '/sass').then(function (items) {
console.log(items);
})
Yielding a result like this:
[
{
'parameters': [
{ 'type': '*', 'name': 'parameter-name', 'default': undefined, 'description': 'description of the parameter' },
{ 'type': 'String', 'name': 'other-parameter', 'default': 'default', 'description': 'parameter with a default value' },
{ 'type': 'ArgList', 'name': 'args', 'default': undefined, 'description': 'extra parameters' }
],
'throws': ['`$other-parameter` must be a string.'],
'todos': [],
'alias': false,
'aliased': 'other-function',
'links': [],
'requires': ['dependency-function'],
'description': 'Function description\n... on several lines if you will',
'access': 'private',
'deprecated': false,
'author': false,
'returns': {
'type': ['String', 'Null'],
'description': 'description of the returned value'
},
'type': 'function',
'name': 'dummy-function'
}
/*,
... other documented mixins/functions.
*/
]
Name of the documented function/mixin is self parsed, hence @name
doesn't exist.
Describes the documented function/mixin. Any line which is nota valid token or a separator line is considered part of the description.
Defines the access of the documented function/mixin. None is considered @access public
.
// @access private
// @access public
// @access protected
It is also possible to define access like this:
// @private
// @public
// @protected
Defines if the documented function/mixin is an alias of another function.
// @alias other-function
Describes the author of the documented function/mixin.
// @author Author's name
Defines if the documented documented function/mixin is deprecated. Message is optional.
// @deprecated
// @deprecated Deprecation related message
Defines a line which won't be documented. Multiple @ignore
allowed on the same function/mixin.
// @ignore Message
Describes a link. Multiple @link
allowed on the same function/mixin.
// @link http://some.url
// @link http://some.url Optional caption
Describes a parameter of the documented function/mixin. Default value and description are optional.
// @param {type | othertype} $name
// @param {type} $name - description
// @param {type} $name (default value) - description of the parameter
Type is any of: arglist
, bool
, color
, list
, map
, null
, number
, string
or *
when any type is allowed. Case insensitive.
Defines if the documented function/mixin requires any other function/mixin. Multiple @requires
allowed on the same function/mixin.
// @requires other-function
Describes the return statement of the documented function/mixin. Description is optional.
// @returns {type | othertype}
// @returns {type} Description of the return statement
Type is one of: arglist
, bool
, color
, list
, map
, null
, number
, string
or *
when any type is allowed. Case insensitive.
Describes the version at which the documented function/mixin has been implemented.
// @since 4.2
Describes the error thrown by the documented function/mixin. Multiple @throws
allowed on the same function/mixin.
// @throws Error related message
Defines any task to do regarding the documented function/mixin. Multiple @todo
allowed on the same function/mixin.
// @todo Task to be done
Describes a variable. Has nothing to do with function/mixin.
// @var {Bool} - Defines whether the library should support legacy browsers (e.g. IE8).
$legacy-support: true !global;
Scope is defined by the (lack of) use of !global
.
Huge thanks to Valérian Galliat for the help.
0.3.1
FAQs
Release the docs!
The npm package sassdoc receives a total of 1,995 weekly downloads. As such, sassdoc popularity was classified as popular.
We found that sassdoc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.