diff --git a/docs/_data/links.json b/docs/_data/links.json index ef45b3b4..f94496f3 100644 --- a/docs/_data/links.json +++ b/docs/_data/links.json @@ -80,6 +80,51 @@ "icon": "plus", "path": "/documentation/overview/mixins" }, + "customize": { + "name": "Customize", + "subtitle": "Create your own theme with a simple set of variables", + "color": "star", + "icon": "paint-brush", + "path": "/documentation/customize" + }, + "customize-concepts": { + "name": "Concepts", + "subtitle": "What makes Bulma customizable", + "color": "info", + "icon": "lightbulb", + "path": "/documentation/customize/concepts" + }, + "customize-variables": { + "name": "Variables", + "subtitle": "See how Bulma uses Sass variables to allow easy customization", + "color": "grey", + "icon": "cogs", + "path": "/documentation/customize/variables" + }, + "customize-node-sass": { + "name": "With node-sass", + "subtitle": "Use npm/yarn and node-sass", + "color": "danger", + "icon_brand": "true", + "icon": "npm", + "path": "/documentation/customize/with-node-sass" + }, + "customize-sass-cli": { + "name": "With Sass CLI", + "subtitle": "Use the Sass command line", + "color": "purple", + "icon_brand": "true", + "icon": "sass", + "path": "/documentation/customize/with-sass-cli" + }, + "customize-webpack": { + "name": "With Webpack", + "subtitle": "Use Bulma with Webpack", + "color": "warning", + "icon_brand": "true", + "icon": "js", + "path": "/documentation/customize/with-webpack" + }, "modifiers": { "name": "Modifiers", "subtitle": "An easy-to-read naming system designed for humans", @@ -506,7 +551,8 @@ "extensions" ], "categories": { - "overview": ["overview-start", "overview-customize", "overview-classes", "overview-modular", "overview-responsiveness", "overview-variables", "overview-colors", "overview-functions", "overview-mixins"], + "overview": ["overview-start", "overview-classes", "overview-modular", "overview-responsiveness", "overview-colors", "overview-functions", "overview-mixins"], + "customize": ["customize-concepts", "customize-variables", "customize-node-sass", "customize-sass-cli", "customize-webpack"], "modifiers": ["modifiers-syntax", "modifiers-helpers", "modifiers-responsive-helpers", "modifiers-color-helpers", "modifiers-typography-helpers"], "columns": ["columns-basics", "columns-sizes", "columns-responsiveness", "columns-nesting", "columns-gap", "columns-options"], "layout": ["layout-container", "layout-level", "layout-media", "layout-hero", "layout-section", "layout-footer", "layout-tiles"], diff --git a/docs/_includes/components/categories.html b/docs/_includes/components/categories.html index 8db78b90..1508a40f 100644 --- a/docs/_includes/components/categories.html +++ b/docs/_includes/components/categories.html @@ -4,7 +4,6 @@ {% assign category_links = category[1] %} {% assign category_link = site.data.links.by_id[category_id] %} - {% if category_link.name != 'Customize' %}
@@ -33,7 +32,6 @@ {% endfor %}
- {% endif %} {% endfor %} diff --git a/docs/_includes/index/customize.html b/docs/_includes/index/customize.html index e87d5d9f..b17bc343 100644 --- a/docs/_includes/index/customize.html +++ b/docs/_includes/index/customize.html @@ -1,4 +1,4 @@ -{% assign customize_link = site.data.links.by_id['overview-customize'] %} +{% assign customize_link = site.data.links.by_id['customize'] %}
diff --git a/docs/_includes/snippets/customized.html b/docs/_includes/snippets/customized.html index e70f152c..0cf4c458 100644 --- a/docs/_includes/snippets/customized.html +++ b/docs/_includes/snippets/customized.html @@ -22,4 +22,4 @@ $input-border-color: transparent; $input-shadow: none; // Import the rest of Bulma -@import "../bulma"; +@import "../path/to/bulma"; diff --git a/docs/_includes/steps/add-custom-styles.html b/docs/_includes/steps/add-custom-styles.html index 20a7dfd9..2f139e2a 100644 --- a/docs/_includes/steps/add-custom-styles.html +++ b/docs/_includes/steps/add-custom-styles.html @@ -49,9 +49,15 @@ $input-shadow: none;
-

- Since you are watching for changes, simply save the file to see the result: -

+ {% if include.build %} +

+ Rebuild the CSS to see the result: +

+ {% else %} +

+ Since you are watching for changes, simply save the file to see the result: +

+ {% endif %}
{% diff --git a/docs/_includes/steps/create-html-page.html b/docs/_includes/steps/create-html-page.html index c12f9b45..3c82e637 100644 --- a/docs/_includes/steps/create-html-page.html +++ b/docs/_includes/steps/create-html-page.html @@ -9,7 +9,7 @@

- Save this file as mypage.html. + Save this file as mypage.html{% if include.dist == true %} in the dist folder{% endif %}.

Notice the css/mystyles.css path for your stylesheet. This will be the location of the CSS file we will generate with Sass. diff --git a/docs/_includes/steps/create-package.html b/docs/_includes/steps/create-package.html new file mode 100644 index 00000000..2a162b61 --- /dev/null +++ b/docs/_includes/steps/create-package.html @@ -0,0 +1,26 @@ +{% 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 {{ include.entry }}. +

+
+{% endcapture %} + +{% assign step_title = '. Create a package.json file' | prepend: include.number %} + +{% include components/step.html + title=step_title + content=step_1 +%} diff --git a/docs/_includes/steps/create-sass-file.html b/docs/_includes/steps/create-sass-file.html index ee999552..8e9daee0 100644 --- a/docs/_includes/steps/create-sass-file.html +++ b/docs/_includes/steps/create-sass-file.html @@ -1,6 +1,6 @@ {% capture scss_bulma %} @charset "utf-8"; -@import "{{ include.path }}/bulma/bulma.sass"; +@import "{{ include.path }}"; {% endcapture %} {% capture step_3 %} @@ -19,9 +19,32 @@
{% endcapture %} +{% capture step_3_bis %} +
+

+ Inside the same src folder, add a file called mystyles.scss: +

+
+ + {% highlight scss %}{{ scss_bulma }}{% endhighlight %} + +
+

+ Make sure to write the correct path to the bulma folder. +

+
+{% endcapture %} + {% assign step_title = ". Create a Sass file" | prepend: include.number %} -{% include components/step.html - title=step_title - content=step_3 -%} +{% if include.bis == true %} + {% include components/step.html + title=step_title + content=step_3_bis + %} +{% else %} + {% include components/step.html + title=step_title + content=step_3 + %} +{% endif %} diff --git a/docs/documentation/customize/concepts.html b/docs/documentation/customize/concepts.html index 4232a992..5fbe1d93 100644 --- a/docs/documentation/customize/concepts.html +++ b/docs/documentation/customize/concepts.html @@ -10,21 +10,26 @@ breadcrumb: - customize-concepts --- +{% assign variables_link = site.data.links.by_id['customize-node-sass'] %} +

Bulma is highly customizable thanks to 415 Sass variables living across 28 files.

- These variables exist at 3 levels: + These variables exist at 4 levels:

+ +

+ This can be achieved with: +

+ +
diff --git a/docs/documentation/customize/variables.html b/docs/documentation/customize/variables.html new file mode 100644 index 00000000..6520108a --- /dev/null +++ b/docs/documentation/customize/variables.html @@ -0,0 +1,107 @@ +--- +title: Variables +layout: documentation +doc-tab: customize +doc-subtab: variables +breadcrumb: +- home +- documentation +- customize +- customize-variables +--- + +{% assign initial_variables = site.data.variables.utilities.initial-variables %} +{% assign initial_vars = initial_variables.by_name %} +{% assign derived_variables = site.data.variables.utilities.derived-variables %} +{% assign derived_vars = derived_variables.by_name %} + +
+

Bulma has two variable files divided into 4 sections:

+ +
    +
  1. + Initial variables: where you define variables by literal value, like: +
      +
    • colors: {{ initial_vars['$blue'].name }}: {{ initial_vars['$blue'].value }}
    • +
    • font sizes: {{ initial_vars['$size-1'].name }}: {{ initial_vars['$size-1'].value }}
    • +
    • dimensions: {{ initial_vars['$gap'].name }}: {{ initial_vars['$gap'].value }}
    • +
    • other values: {{ initial_vars['$easing'].name }}: {{ initial_vars['$easing'].value }} or {{ initial_vars['$radius-large'].name }}: {{ initial_vars['$radius-large'].value }}
    • +
    +
  2. +
  3. + Derived variables where variables are calculated from the values set in the previous file. For example, you can have: +
      +
    • + Primary colors derived from the initial variables: +
        +
      • {{ derived_vars['$primary'].name }}: {{ derived_vars['$primary'].value }}
      • +
      • {{ derived_vars['$link'].name }}: {{ derived_vars['$link'].value }}
      • +
      • {{ derived_vars['$info'].name }}: {{ derived_vars['$info'].value }}
      • +
      • {{ derived_vars['$success'].name }}: {{ derived_vars['$success'].value }}
      • +
      • {{ derived_vars['$warning'].name }}: {{ derived_vars['$warning'].value }}
      • +
      • {{ derived_vars['$danger'].name }}: {{ derived_vars['$danger'].value }}
      • +
      • {{ derived_vars['$dark'].name }}: {{ derived_vars['$dark'].value }}
      • +
      • {{ derived_vars['$text'].name }}: {{ derived_vars['$text'].value }}
      • +
      +
    • +
    • {{ derived_vars['$background'].name }}: {{ derived_vars['$background'].value }}: a general background color
    • +
    • {{ derived_vars['$link'].name }}: {{ derived_vars['$link'].value }}: the links use the primary color
    • +
    • {{ derived_vars['$family-primary'].name }}: {{ derived_vars['$family-primary'].value }}: the primary font family is the sans-serif one
    • +
    • + Lists and maps which are collections of already defined variables: +
        +
      • {{ derived_vars['$colors'].name }}: {{ derived_vars['$colors'].value }}
      • +
      • {{ derived_vars['$shades'].name }}: {{ derived_vars['$shades'].value }}
      • +
      • {{ derived_vars['$sizes'].name }}: {{ derived_vars['$sizes'].value }}
      • +
      +
    • +
    +
  4. +
+ +

+ To override any of these variables, just set them before importing Bulma. +

+
+ +{% include elements/anchor.html name="Initial variables" %} + +
+

+ These are initial variables with a literal value. +

+
+ + + + {% for variable_name in initial_variables.list %} + {% assign variable = initial_vars[variable_name] %} + {% include elements/variable-row.html variable=variable hide_computed =true%} + {% endfor %} + +
+ +{% capture custom_message %} + These are variables with a value that references another variable. +{% endcapture %} + +{% + include elements/variables.html + anchor_name = 'Derived variables' + data = derived_variables + custom_message = custom_message + table_class = 'is-bordered' +%} + +{% capture custom_message %} + You can use the following generic variables for general customization. Simply set one or multiple of these variables before importing Bulma. Learn how. +{% endcapture %} + +{% + include elements/variables.html + anchor_name = 'Generic variables' + tab = 'base' + subtab = 'generic' + custom_message = custom_message + table_class = 'is-bordered' +%} diff --git a/docs/documentation/customize/with-node-sass.html b/docs/documentation/customize/with-node-sass.html index edda5d4a..ebf86b4b 100644 --- a/docs/documentation/customize/with-node-sass.html +++ b/docs/documentation/customize/with-node-sass.html @@ -10,26 +10,6 @@ breadcrumb: - 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 @@ -112,10 +92,10 @@ npm start

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

- - {% highlight bash %}{{ npm_build }}{% endhighlight %} + {% highlight bash %}{{ npm_build }}{% endhighlight %} +

If set up correctly, you will see the following message: @@ -149,9 +129,9 @@ npm start {% highlight bash %}{{ npm_watch }}{% endhighlight %} {% endcapture %} -{% include components/step.html - title='1. Create a package.json file' - content=step_1 +{% include steps/create-package.html + number="1" + entry="sass/mystyles.scss" %}


@@ -165,7 +145,7 @@ npm start {% include steps/create-sass-file.html number="3" - path="../node_modules" + path="../node_modules/bulma/bulma.sass" %}
diff --git a/docs/documentation/customize/with-sass-cli.html b/docs/documentation/customize/with-sass-cli.html index 3de5e46a..50d52f6b 100644 --- a/docs/documentation/customize/with-sass-cli.html +++ b/docs/documentation/customize/with-sass-cli.html @@ -119,7 +119,7 @@ sass --watch --sourcemap=none sass/mystyles.scss:css/mystyles.css
-{% assign bulma_path = site.data.meta.version | prepend: "../bulma-" %} +{% assign bulma_path = site.data.meta.version | prepend: "../bulma-" | append: "/bulma/bulma.sass" %} {% include steps/create-sass-file.html number="3" diff --git a/docs/documentation/customize/with-webpack.html b/docs/documentation/customize/with-webpack.html new file mode 100644 index 00000000..6268b211 --- /dev/null +++ b/docs/documentation/customize/with-webpack.html @@ -0,0 +1,223 @@ +--- +title: With webpack +layout: documentation +doc-tab: customize +doc-subtab: webpack +breadcrumb: +- home +- documentation +- customize +- customize-webpack +--- + +{% capture dependencies %} +npm install bulma --save-dev +npm install css-loader --save-dev +npm install extract-text-webpack-plugin@next --save-dev +npm install node-sass --save-dev +npm install sass-loader --save-dev +npm install style-loader --save-dev +npm install webpack --save-dev +npm install webpack-cli --save-dev +{% endcapture %} + +{% capture package %} +{ + "name": "mybulma", + "version": "1.0.0", + "main": "webpack.config.js", + "license": "MIT", + "devDependencies": { + "bulma": "^0.7.1", + "css-loader": "^1.0.0", + "extract-text-webpack-plugin": "^4.0.0-beta.0", + "node-sass": "^4.9.2", + "sass-loader": "^7.0.3", + "style-loader": "^0.21.0", + "webpack": "^4.16.0", + "webpack-cli": "^3.0.8" + } +} +{% endcapture %} + +{% capture step_2 %} +
+

+ Install the packages required to parse and build your CSS: +

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

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

+
+ + {% highlight bash %}{{ package }}{% endhighlight %} +{% endcapture %} + +{% capture config %} +const path = require('path'); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); + +module.exports = { + entry: './src/index.js', + output: { + path: path.resolve(__dirname, 'dist'), + filename: 'js/bundle.js' + }, + module: { + rules: [{ + test: /\.scss$/, + use: ExtractTextPlugin.extract({ + fallback: 'style-loader', + use: [ + 'css-loader', + 'sass-loader' + ] + }) + }] + }, + plugins: [ + new ExtractTextPlugin('css/mystyles.css'), + ] +}; +{% endcapture %} + +{% capture step_3 %} +
+

+ Create a webpack.config.js file: +

+
+ +
+ {% highlight js %}{{ config }}{% endhighlight %} +
+ +
+

+ This setup takes the src folder as input, and outputs in the dist folder. +

+
+{% endcapture %} + +{% capture require_css %} +require('./mystyles.scss'); +{% endcapture %} + +{% capture step_4 %} +
+

+ Create a src folder in which you add a file called index.js with the following content: +

+
+ + {% highlight js %}{{ require_css }}{% endhighlight %} +{% endcapture %} + +{% capture step_6 %} +
+

+ 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. +

+
+{% endcapture %} + +{% capture webpack_script %} +"scripts": { + "build": "webpack --mode production" +}, +{% endcapture %} + +{% capture npm_build %} +npm run build +{% endcapture %} + +{% capture npm_build_success %} +Rendering Complete, saving .css file... +Wrote CSS to /path/to/mybulma/css/mystyles.css +{% endcapture %} + +{% capture step_8 %} +
+

+ In package.json, add the following: +

+
+ + {% highlight html %}{{ webpack_script }}{% endhighlight %} + +
+

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

+
+ + {% highlight bash %}{{ npm_build }}{% endhighlight %} +{% endcapture %} + +{% include steps/create-package.html + number="1" + entry="webpack.config.js" +%} + +
+ +{% include components/step.html + title="2. Install the dev dependencies" + content=step_2 +%} + +
+ +{% include components/step.html + title="3. Create a webpack config" + content=step_3 +%} + +
+ +{% include components/step.html + title="4. Create a src folder" + content=step_4 +%} + +
+ +{% include steps/create-sass-file.html + number="5" + path='~bulma/bulma' + bis=true +%} + +
+ +{% include components/step.html + title="6. Create a dist folder" + content=step_6 +%} + +
+ +{% include steps/create-html-page.html + number="7" + dist=true +%} + +
+ +{% include components/step.html + title="8. Add node scripts to build your bundle" + content=step_8 +%} + +
+ +{% include steps/add-custom-styles.html + number="9" + build=true +%} + diff --git a/docs/documentation/overview/customize.html b/docs/documentation/overview/customize.html index e3191085..72a8fdc3 100644 --- a/docs/documentation/overview/customize.html +++ b/docs/documentation/overview/customize.html @@ -10,6 +10,8 @@ breadcrumb: - overview-customize --- + + {% capture scss_code %} // 1. Import the initial variables @import "../sass/utilities/initial-variables"; diff --git a/docs/documentation/overview/variables.html b/docs/documentation/overview/variables.html index 621265cd..3374a63e 100644 --- a/docs/documentation/overview/variables.html +++ b/docs/documentation/overview/variables.html @@ -10,6 +10,8 @@ breadcrumb: - overview-variables --- + + {% assign initial_variables = site.data.variables.utilities.initial-variables %} {% assign initial_vars = initial_variables.by_name %} {% assign derived_variables = site.data.variables.utilities.derived-variables %}