--- title: With node-sass layout: documentation doc-tab: customize doc-subtab: node-sass breadcrumb: - home - documentation - customize - customize-node-sass --- {% capture init %} npm init {% endcapture %} {% capture step_1 %}

In your terminal, create a new folder called mybulma, navigate to it, then type the following command:

{% highlight bash %}{{ init }}{% endhighlight %}

This will launch an interactive setup to create package.json. When prompted for an entry point, enter sass/mystyles.scss.

{% endcapture %} {% capture dependencies %} npm install node-sass --save-dev npm install bulma --save-dev {% endcapture %} {% capture package %} { "name": "mybulma", "version": "1.0.0", "main": "sass/mystyles.scss", "license": "MIT", "devDependencies": { "bulma": "^0.7.1", "node-sass": "^4.9.2" } } {% endcapture %} {% capture step_2 %}

You only need 2 packages to customize Bulma: node-sass and bulma itself.

{% highlight bash %}{{ dependencies }}{% endhighlight %}

Your package.json should look like this at this point.

{% highlight bash %}{{ package }}{% endhighlight %} {% endcapture %} {% capture scripts %} "scripts": { "css-build": "node-sass --omit-source-map-url sass/mystyles.scss css/mystyles.css", "css-watch": "npm run css-build -- --watch", "start": "npm run css-watch" } {% endcapture %} {% capture npm_build %} npm run css-build {% endcapture %} {% capture npm_build_success %} Rendering Complete, saving .css file... Wrote CSS to /path/to/mybulma/css/mystyles.css {% endcapture %} {% capture npm_watch %} npm start {% endcapture %} {% capture step_5 %}

To build a CSS file from a Sass file, we can use node scripts. In package.json, add the following:

{% highlight html %}{{ scripts }}{% endhighlight %}

To test it out, go in your terminal and run the following command:

{% highlight bash %}{{ npm_build }}{% endhighlight %}

If set up correctly, you will see the following message:

{% highlight bash %}{{ npm_build_success }}{% endhighlight %}

Reload the page and it should be styled like this:

{% include components/figure.html path="customize/custom-bulma-02-default" extension="png" alt="Bulma default styles" width="600" height="300" caption="Bulma's default styles" %}

To watch for changes, just launch the following command:

{% highlight bash %}{{ npm_watch }}{% endhighlight %} {% endcapture %} {% include components/step.html title='1. Create a package.json file' content=step_1 %}
{% include components/step.html title="2. Install the dev dependencies" content=step_2 %}
{% include steps/create-sass-file.html number="3" path="../node_modules" %}
{% include steps/create-html-page.html number="4" %}
{% include components/step.html title="5. Add node scripts to build your CSS" content=step_5 %}
{% include steps/add-custom-styles.html number="6" %}