Skip to content

Commit c80e158

Browse files
authored
Add bulma support (#19)
1 parent 57da0eb commit c80e158

File tree

4 files changed

+54
-3
lines changed

4 files changed

+54
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CSS Bundling for Rails
22

3-
Use [Tailwind CSS](https://tailwindcss.com), [Bootstrap](https://getbootstrap.com/), [PostCSS](https://postcss.org), or [Dart Sass](https://sass-lang.com/) to bundle and process your CSS, then deliver it via the asset pipeline in Rails. This gem provides installers to get you going with the bundler of your choice in a new Rails application, and a convention to use `app/assets/builds` to hold your bundled output as artifacts that are not checked into source control (the installer adds this directory to `.gitignore` by default).
3+
Use [Tailwind CSS](https://tailwindcss.com), [Bootstrap](https://getbootstrap.com/), [Bulma](https://bulma.io/), [PostCSS](https://postcss.org), or [Dart Sass](https://sass-lang.com/) to bundle and process your CSS, then deliver it via the asset pipeline in Rails. This gem provides installers to get you going with the bundler of your choice in a new Rails application, and a convention to use `app/assets/builds` to hold your bundled output as artifacts that are not checked into source control (the installer adds this directory to `.gitignore` by default).
44

55
You develop using this approach by running the bundler in watch mode in a terminal with `yarn build:css --watch` (and your Rails server in another, if you're not using something like [puma-dev](https://github.com/puma/puma-dev)). Whenever the bundler detects changes to any of the stylesheet files in your project, it'll bundle `app/assets/stylesheets/application.[bundler].css` into `app/assets/builds/application.css`. This build output takes over from the regular asset pipeline default file. So you continue to refer to the build output in your layout using the standard asset pipeline approach with `<%= stylesheet_link_tag "application" %>`.
66

@@ -21,9 +21,9 @@ You must already have node and yarn installed on your system. You will also need
2121

2222
1. Add `cssbundling-rails` to your Gemfile with `gem 'cssbundling-rails'`
2323
2. Run `./bin/bundle install`
24-
3. Run `./bin/rails css:install:[tailwind|bootstrap|postcss|sass]`
24+
3. Run `./bin/rails css:install:[tailwind|bootstrap|bulma|postcss|sass]`
2525

26-
Or, in Rails 7+, you can preconfigure your new application to use a specific bundler with `rails new myapp --css [tailwind|bootstrap|postcss|sass]`.
26+
Or, in Rails 7+, you can preconfigure your new application to use a specific bundler with `rails new myapp --css [tailwind|bootstrap|bulma|postcss|sass]`.
2727

2828

2929
## License
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// @charset "utf-8";
2+
3+
// Import a Google Font
4+
// @import url('https://fonts.googleapis.com/css?family=Nunito:400,700');
5+
6+
// Set your brand colors
7+
// $purple: #8A4D76;
8+
// $pink: #FA7C91;
9+
// $brown: #757763;
10+
// $beige-light: #D0D1CD;
11+
// $beige-lighter: #EFF0EB;
12+
13+
// Update Bulma's global variables
14+
// $family-sans-serif: "Nunito", sans-serif;
15+
// $grey-dark: $brown;
16+
// $grey-light: $beige-light;
17+
// $primary: $purple;
18+
// $link: $pink;
19+
// $widescreen-enabled: false;
20+
// $fullhd-enabled: false;
21+
22+
// Update some of Bulma's component variables
23+
// $body-background-color: $beige-lighter;
24+
// $control-border-width: 2px;
25+
// $input-border-color: transparent;
26+
// $input-shadow: none;
27+
28+
// Import only what you need from Bulma
29+
// @import "bulma/sass/utilities/_all.sass";
30+
// @import "bulma/sass/base/_all.sass";
31+
// @import "bulma/sass/elements/button.sass";
32+
// @import "bulma/sass/elements/container.sass";
33+
// @import "bulma/sass/elements/title.sass";
34+
// @import "bulma/sass/form/_all.sass";
35+
// @import "bulma/sass/components/navbar.sass";
36+
// @import "bulma/sass/layout/hero.sass";
37+
// @import "bulma/sass/layout/section.sass";
38+
39+
@import 'bulma/bulma';

lib/install/bulma/install.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
say "Install Bulma"
2+
copy_file "#{__dir__}/application.bulma.scss",
3+
"app/assets/stylesheets/application.bulma.scss"
4+
run "yarn add sass bulma"
5+
6+
say "Add build:css script"
7+
run %(npm set-script build:css "sass ./app/assets/stylesheets/application.bulma.scss ./app/assets/builds/application.css --no-source-map --load-path=node_modules")

lib/tasks/cssbundling/install.rake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ namespace :css do
2424
task bootstrap: "css:install:shared" do
2525
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/bootstrap/install.rb", __dir__)}"
2626
end
27+
28+
desc "Install Bulma"
29+
task bulma: "css:install:shared" do
30+
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/bulma/install.rb", __dir__)}"
31+
end
2732
end
2833
end

0 commit comments

Comments
 (0)