在您的终端,创建一个叫做 mybulma
的新文件夹,进入该文件夹,然后键入下面命令:
With webpack
Use Bulma with webpack
1. 创建一个 package.json
文件
#
这家载入一个互动安装程序创建 package.json
。当提示输入一个入口点(entry point)时,输入 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 (Webpack <= 3) #
Create a webpack.config.js
file:
This setup takes the src
folder as input, and outputs in the dist
folder.
3.5. Create a webpack config (Webpack 4) #
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. 创建一个 Sass 文件 #
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. 创建一个 HTML 页面 #
创建一个使用 Bulma 组件的 HTML 模板。
保存文件为 mypage.html
,同时确保该文件在文件夹 dist
内。
注意 css/mystyles.css
路径是您的样式表。这时我们要用 Sass 生成的 CSS 文件的位置。
在您的浏览器内打开页面:
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. 添加您自己的 Bulma 样式 #
用下面代码替换 mystyles.scss
文件内容:
重新编译 CSS 查看结果:
嗯,voilà!您可以安装和定制 Bulma 啦。
此页面为开放源码页面。
发现排版问题?或者表达模糊?
在 GitHub 改进该页内容