cssbundling-rails 0.1.6 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe36ff64ebb7a3e45b17d6ce9b8f17646f553688ddfc2394c2b6afa266381bb0
4
- data.tar.gz: e76290b4d74b34c56bd3c8ade7758a9b8108ee64da63b047d3a284357a9b1d1e
3
+ metadata.gz: 2797362606014e22f06d64b71862e559ade59ef92900346619f9a409d2152012
4
+ data.tar.gz: bf6461b042e39d6642cacaf283be4b3a11c97e12b7153465c3c4c825a23eeb72
5
5
  SHA512:
6
- metadata.gz: 0c122aae327a208eb707a291852d96fea430939cea9ad7a1dae182f03efb1f9201c0b2a917e93159c114e7a4e544b10c8faf8f4b8b5b506524d7ef07a405270f
7
- data.tar.gz: 5378466b5910acf675be8499cddcb7cb37c39531d4dbc71be6004066ef285438331405faf77c89573f8024f33d3cdcb29d9edcdf0d834a2a5df8db845d4333e9
6
+ metadata.gz: bf137fecb7c1ec88fafc3d27bb36c5466605e4fe3336f07a7a7e35e9079252ed7a4fa29319e1da6855e3b8e1c6813ede5debff6cdfa605f1cc6ccd2b4f614a41
7
+ data.tar.gz: 3bd5553f3033beb8f46906c2728c7f7b941aad7c3d0d7c446635324f6bcaf9d87b67edb12babc232ca01a863968c16b22d2bc6c128b6740f003ef5b30dc44c9c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CSS Bundling for Rails
2
2
 
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).
4
4
 
5
5
  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" %>`.
6
6
 
@@ -21,9 +21,9 @@ You must already have node and yarn installed on your system. You will also need
21
21
 
22
22
  1. Add `cssbundling-rails` to your Gemfile with `gem 'cssbundling-rails'`
23
23
  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]`
25
25
 
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]`.
27
27
 
28
28
 
29
29
  ## License
@@ -1,3 +1,3 @@
1
1
  module Cssbundling
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -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';
@@ -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")
@@ -1,25 +1,47 @@
1
1
  say "Build into app/assets/builds"
2
2
  empty_directory "app/assets/builds"
3
3
  keep_file "app/assets/builds"
4
- append_to_file "app/assets/config/manifest.js", %(//= link_tree ../builds\n)
5
4
 
6
- say "Stop linking stylesheets automatically"
7
- gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css", ""
5
+ if (sprockets_manifest_path = Rails.root.join("app/assets/config/manifest.js")).exist?
6
+ append_to_file sprockets_manifest_path, %(//= link_tree ../builds\n)
7
+
8
+ say "Stop linking stylesheets automatically"
9
+ gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css\n", ""
10
+ end
8
11
 
9
12
  if Rails.root.join(".gitignore").exist?
10
- append_to_file(".gitignore", %(/app/assets/builds\n!/app/assets/builds/.keep\n))
13
+ append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
14
+ append_to_file(".gitignore", %(\n/node_modules\n))
11
15
  end
12
16
 
13
17
  say "Remove app/assets/stylesheets/application.css so build output can take over"
14
18
  remove_file "app/assets/stylesheets/application.css"
15
19
 
20
+ if (app_layout_path = Rails.root.join("app/views/layouts/application.html.erb")).exist?
21
+ say "Add stylesheet link tag in application layout"
22
+ insert_into_file(
23
+ app_layout_path.to_s,
24
+ defined?(Turbo) ?
25
+ %(\n <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>) :
26
+ %(\n <%= stylesheet_link_tag "application" %>),
27
+ before: /\s*<\/head>/
28
+ )
29
+ else
30
+ say "Default application.html.erb is missing!", :red
31
+ if defined?(Turbo)
32
+ say %( Add <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
33
+ else
34
+ say %( Add <%= stylesheet_link_tag "application" %> within the <head> tag in your custom layout.)
35
+ end
36
+ end
37
+
16
38
  unless Rails.root.join("package.json").exist?
17
39
  say "Add default package.json"
18
40
  copy_file "#{__dir__}/package.json", "package.json"
19
41
  end
20
42
 
21
43
  if Rails.root.join("Procfile.dev").exist?
22
- append_to_file "Procfile.dev", "css: yarn build:css --watch"
44
+ append_to_file "Procfile.dev", "css: yarn build:css --watch\n"
23
45
  else
24
46
  say "Add default Procfile.dev"
25
47
  copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
@@ -6,4 +6,9 @@ namespace :css do
6
6
  end
7
7
 
8
8
  Rake::Task["assets:precompile"].enhance(["css:build"])
9
- Rake::Task["test:prepare"].enhance(["css:build"]) if Rake::Task.task_defined?("test:prepare")
9
+
10
+ if Rake::Task.task_defined?("test:prepare")
11
+ Rake::Task["test:prepare"].enhance(["css:build"])
12
+ elsif Rake::Task.task_defined?("db:test:prepare")
13
+ Rake::Task["db:test:prepare"].enhance(["css:build"])
14
+ end
@@ -24,5 +24,10 @@ namespace :css do
24
24
  task bootstrap: "css:install:shared" do
25
25
  system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../../install/bootstrap/install.rb", __dir__)}"
26
26
  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
27
32
  end
28
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cssbundling-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-09-10 00:00:00.000000000 Z
12
+ date: 2021-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -53,6 +53,8 @@ files:
53
53
  - lib/install/Procfile.dev
54
54
  - lib/install/bootstrap/application.bootstrap.scss
55
55
  - lib/install/bootstrap/install.rb
56
+ - lib/install/bulma/application.bulma.scss
57
+ - lib/install/bulma/install.rb
56
58
  - lib/install/dev
57
59
  - lib/install/install.rb
58
60
  - lib/install/package.json