cssbundling-rails 0.1.5 → 0.2.0

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: f1cb16bc8fd46769c9ceee9130fe3146da522850768c6d004043cab54fa45595
4
- data.tar.gz: cd894d657fcc8d2d55c14d61674f85627ea6e7cb0d3d2375c1d8ea5529f531b4
3
+ metadata.gz: b6117a89a0593ef2dee1518e29ab5792245610a4acd449b2f43dab754c421a56
4
+ data.tar.gz: ae5a61e547d29d5fc9a44bf6a28ecbc24fde91194cdc1262417ec6d3b17810f0
5
5
  SHA512:
6
- metadata.gz: ef825dd44a3654b15d488894b19f01020be3020129a2ba45934b5e7860f17824120336109dc15de9a109c6d3e0bf080b0686bed761ade6d29314bb238a905d96
7
- data.tar.gz: 2b7c58fb054093ad72f89b34472ae38b0a33ea9a16b4565139d90860c6cb1affa890fac65e7530f37ae626bcf2d8f718072cabe752b637990cf1354b6b295ecd
6
+ metadata.gz: cd33d2acdc38b13ee350cc703b97e9eae5bd4a4eef67edda05acde3f237b73b3a93c9012edb759b86aed22888832ad72bd17a111abf81fe97ca5f218c7e6f6e0
7
+ data.tar.gz: 8649ee814fac443401fea17891629d3f1f4f1fc5fb135f27eb3a662550b4bbbb29906344fe01d08a4ffd0f3305802a79effdd4542f2b76b6155f349a8ef5b124
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CSS Bundling for Rails
2
2
 
3
- Use [Tailwind CSS](https://tailwindcss.com), [PostCSS](https://postcss.org), [Dart Sass](https://sass-lang.com/), or [Bootstrap](https://getbootstrap.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|postcss|sass|bootstrap]`
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|postcss|sass|bootstrap]`.
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.5"
2
+ VERSION = "0.2.0"
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)
4
+
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
+ end
5
8
 
6
9
  say "Stop linking stylesheets automatically"
7
- gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css", ""
10
+ gsub_file "app/assets/config/manifest.js", "//= link_directory ../stylesheets .css\n", ""
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.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,10 +9,10 @@ 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
- name: rails
15
+ name: railties
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 6.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: sprockets-rails
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 2.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 2.0.0
28
42
  description:
29
43
  email: david@loudthinking.com
30
44
  executables: []
@@ -39,6 +53,8 @@ files:
39
53
  - lib/install/Procfile.dev
40
54
  - lib/install/bootstrap/application.bootstrap.scss
41
55
  - lib/install/bootstrap/install.rb
56
+ - lib/install/bulma/application.bulma.scss
57
+ - lib/install/bulma/install.rb
42
58
  - lib/install/dev
43
59
  - lib/install/install.rb
44
60
  - lib/install/package.json
@@ -75,5 +91,6 @@ requirements: []
75
91
  rubygems_version: 3.1.4
76
92
  signing_key:
77
93
  specification_version: 4
78
- summary: Bundle and process CSS with Tailwind, PostCSS, or Sass in Rails via Node.js.
94
+ summary: Bundle and process CSS with Tailwind, Bootstrap, PostCSS, Sass in Rails via
95
+ Node.js.
79
96
  test_files: []