{% extends 'layouts/docs.html' %} {% set page = references.customBuilds %} {% block content %}

Basscss is a collection of interoperable CSS modules and can be used in conjunction with many other frameworks, libraries, and stylesheets. {# While the source code is written in spec-based CSS, it can also be incorporated into Sass projects through NPM or Bower, or customized with the Customize web app. #}

Rework

Rework is the most native way to incorporate Basscss into a project, and its concepts should be somewhat familiar to those who use other preprocessors, such as Sass or Less, and to those who are comfortable with the command line.

Rework is a Node-based preprocessor with a plugin architecture and syntax based on the CSS specification. Rework requires NPM, and Basscss uses this package management system for its modular architecture. If you prefer using Bower, see the Bower Section below.

Bassplate

The quickest way to get familiar with using Rework is through the official boilerplate project Bassplate, which includes Gulp tasks and basic file and folder structure for building a simple website.

To get started, clone the repo, install dependencies, and run the default Gulp task.

{% highlight 'bash' %}
git clone https://github.com/jxnblk/bassplate.git new-project
cd new-project
rm -rf .git
npm install
gulp
{% endhighlight %}

This will start a server at http://localhost:8000 and watch the /src folder for changes. Edit the files in /src/css to customize the compiled stylesheet.

Basswork

Basswork is a CSS preprocessor for Basscss built with Rework. To set up Basscss in an existing Node-base build system, use Basswork or Gulp Basswork to compile a set of modules.

NPM Packages

All individual Basscss modules are available on NPM. For a list of available packages, see the Modules page.

Rework Syntax

To import modules that have been installed through NPM, use the following syntax:

{% highlight 'css' %}
@import 'basscss-base-typography';
@import 'basscss-defaults';
{% endhighlight %}

To import modules relative to the parent file, use this syntax:

{% highlight 'css' %}
@import './custom-buttons';
{% endhighlight %}

Import variables last. Just as with other CSS declarations, whatever is last in the source code is used.

{% highlight 'css' %}
@import 'basscss-utility-layout';
@import './variables';
{% endhighlight %}

To use variables in declarations, follow this CSS syntax:

{% highlight 'css' %}
.button-primary {
  background-color: var(--blue);
}
{% endhighlight %}

For more, see the Using Rework page.

Sass

The core package includes the standard modules as Sass partials in the scss folder. Import individual modules in your own file as needed, with the default variables file first.

{% highlight 'scss' %}
@import: 'basscss/scss/defaults';
@import: 'basscss/scss/utility-layout';
{% endhighlight %}

To override the default values, include your own variable definitions before Basscss.

{% highlight 'scss' %}
// Custom variables
@import: 'variables';

// Basscss
@import: 'basscss/scss/defaults';
@import: 'basscss/scss/utility-layout';
{% endhighlight %}

Sass with Bower

Although Basscss’s individual modules are distributed through NPM, the core package is available through Bower, which contains the compiled CSS as well as the standard set of modules as Sass partials.

To get started, install the package:

{% highlight 'bash' %}
bower install basscss
{% endhighlight %}

To import modules without specifying the Bower folder, add bower_components/basscss/scss to the includePaths option.

{% highlight 'js' %}
var options = {
  includePaths: ['bower_components/']
}
{% endhighlight %}
{% highlight 'scss' %}
@import "basscss/scss/defaults";
@import "basscss/scss/base-reset";
@import "basscss/scss/base-typography";
{% endhighlight %}

Web App

If you’re not ready to dive into the command line, you can create custom builds of Basscss with the web app.

Customize
{% endblock %}