In your terminal, create a new folder called mybulma
, navigate to it, then type the following command:
With webpack
Use Bulma with webpack
1. Create a package.json
file
#
This will launch an interactive setup to create package.json
. When prompted for an entry point, enter webpack.config.js
.
2. Install the dev dependencies #
Install the packages required to parse and build your CSS:
Your package.json
should look like this at this point.
3. Create a webpack config #
Create a webpack.config.js
file:
This setup takes the src
folder as input, and outputs in the dist
folder.
4. Create a src
folder
#
Create a src
folder in which you add a file called index.js
with the following content:
5. Create a Sass file #
Inside the same src
folder, add a file called mystyles.scss
:
Make sure to write the correct path to the bulma
folder.
6. Create a dist
folder
#
Create a dist
folder in which you add a css
folder, and a js
folder. Leave these last two folders empty. Their content will be generated by the webpack build.
7. Create an HTML page #
Create an HTML template which uses several Bulma components.
Save this file as mypage.html
in the dist
folder.
Notice the css/mystyles.css
path for your stylesheet. This will be the location of the CSS file we will generate with Sass.
Open the page in your browser:
8. Add node scripts to build your bundle #
In package.json
, add the following:
To test it out, go in your terminal and run the following command:
9. Add your own Bulma styles #
Replace the content of the mystyles.scss
file with the following:
Rebuild the CSS to see the result:
And voilà! You've managed to install and customize Bulma.
This page is open source.
Noticed a typo? Or something unclear?
Improve this page on GitHub