npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sass-corius

v0.1.2

Published

A base for Sass libraries. The aim is to provide a starting point for solid Sass development by including tools that encourage optimal Sass development for not just you, but the developers around you.

Downloads

2

Readme

Corius

A base for Sass libraries. The aim is to provide a starting point for solid Sass development by including tools that encourage optimal Sass development for not just you, but the developers around you.

Features

Installation

npm install -g gulp-cli mocha && npm install

Usage

Watch (Compile + Lint) Sass:

gulp

Compile Sass:

gulp sass

Lint Sass:

gulp lint

Test Sass:

gulp test

Document Sass:

gulp doc

Build Library (Compile + Lint + Test + Document):

gulp build

Yeoman Generator

To make life easier, try the Corius Yeoman Generator.

Further Reading

LibSass

In case you haven't heard, LibSass is a C implementation of Sass. This creates a portable codebase which is a lot faster than the original Ruby source. You can read more about LibSass.

To implement LibSass, we have to use a wrapper. In this case, we are using the Node wrapper, node-sass.

Run gulp to watch your Sass for changes and compile or gulp sass to compile your Sass as a one off.

Task Automation

To automate common tasks such as compiling, linting and testing Sass, we use a task automator, Gulp. You can view and configure the tasks in gulpfile.js.

Utilities

Keeping your code DRY is an important concept. You don't and shouldn't have to reinvent the wheel in each of your Sass libraries. Using other libraries such as Sassdash will help save yourself from writing abstract functionality, such as map and list functions. Although they may seem daunting at first, getting aquianted with these libraries will reduce errors and extra code/responsibility.

Linting

Everyone has there own way of writing code, so it's good to keep a few ground rules. Linting helps you and your team to write consistent code. This helps keep a nice readable codebase that can actually be maintained.

It's a good idea to consistently lint your code at all times, not right at the end. Use gulp-sass-lint to automate linting. This is done in the default watch task (when you run gulp in the terminal) or on the lint task (wehn you run gulp lint in the terminal).

Documentation

This is an essential component to a clean and maintainable code base. Your code should be documented not just for yourself, but also for anyone else wanting to either use your library or maintain it after you.

It's a good idea to document your code at all times, not right at the end.

By documenting file headers and code blocks, this library can generate documentation for you. Sassdoc will parse your code and Sassdoc Theme - Markdown will create the markdown files for you. This means that your documentation can live in the repository and is easily viewable when your repo is stored in a git hosting service such as GitHub or BitBucket.

To generate documentation, run gulp doc in your terminal. The markdown files will be generated in the doc directory in the root of the library.

Use these doc blocks in your code or view the annotations.

Sassdoc Blocks

File

Use this as a boilerplate for file headers:

////
/// File Name
/// File Description
/// @group example-api
/// @author John Doe
////
Block

Use this as a boilerplate for code blocks such as variables, mixins and functions:

//  @type name
/// Description.
///
/// @todo Task to be done.
///
/// @since 1.0.0
/// @type Bool | String
/// @access private
/// @group helpers
///
/// @throws Error related message.
///
/// @link http:// some.url Optional caption.
///
/// @requires other-item
/// @requires {mixin} other-item
/// @requires $other-item
/// @requires %other-item
///
/// @param {List} $foo
/// @param {List | String} $foo
/// @param {List} $foo Description.
/// @param {List} $foo (false) Description.
/// 
/// @returns {List | String} Description.
/// 
/// @example scss - Description.
///   (example)
///   // (result)

Unit Testing

Unit testing is vital for a good maintainable codebase. It prevents bugs from happening during development, as well as when trying to work on new features. Failing to unit test will probably lead to either you or others encountering frustrating errors.

You should be writing unit tests consistently, not right at the end.

Here's how we do it:

  1. The entry point is test/test.scss. You should import your seperate tests from there.
  2. Starting writing your unit tests. View test/src/_example.scss for assertions examples on functions and mixins. Each assertion should be short and concise.
  3. Run gulp test to start the tests.

For more information on unit testing, I encourage you to read up on true.