cssbundling-rails 0.1.7 → 0.2.2

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: 7b949bceafaa77019bd9d046505043f55499bd2a7a8d388c8452fb6013b9875e
4
- data.tar.gz: 0f9fd5b7e082e8d40dea90996a309482cb92e5716f7f65e847e116bccc21e2dc
3
+ metadata.gz: c5be53848365bc063ba001b88c7e2f125b8f434dc0dff7b2bd2046cefeada38d
4
+ data.tar.gz: 45502e231a93390c1fea3dccc6cb345b3ea63f1e57754906dc5c344a66fed61a
5
5
  SHA512:
6
- metadata.gz: 48fe191fae553691b4f5cb94559795090356cb9d3eb00f4a5f4b7625e56f194ba7711b2c296a068d41097b27f21e3b4ad20da62edac535530d52e9e83a5d0ef4
7
- data.tar.gz: a6b27be310ae773882019806a5a2256a0cf2a74898cf8b9f9dd9e994c2fd942bc6b0cea7ed05f39b6d1a64bc9fc4896cee61f53cfd8424351a0afc5f34113a03
6
+ metadata.gz: 5ce45e6fcfcf1262f4075f2e2729b0ac538e7e97a483f18547a04084e9b5444e07adb4e92f2aa88a73fe0b3b26aac5755335be7eb040dae6cc48bb0fa1487e67
7
+ data.tar.gz: 7474397e610d94244b003e444342623b4d148f49f9a436775f63da856043d6c120be1d6ac9d316f6f559b6813eefc6b23c880b22450f155b9902ee3c61ca653b
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.7"
2
+ VERSION = "0.2.2"
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"
@@ -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.7
4
+ version: 0.2.2
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-13 00:00:00.000000000 Z
12
+ date: 2021-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -25,20 +25,6 @@ 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
42
28
  description:
43
29
  email: david@loudthinking.com
44
30
  executables: []
@@ -53,6 +39,8 @@ files:
53
39
  - lib/install/Procfile.dev
54
40
  - lib/install/bootstrap/application.bootstrap.scss
55
41
  - lib/install/bootstrap/install.rb
42
+ - lib/install/bulma/application.bulma.scss
43
+ - lib/install/bulma/install.rb
56
44
  - lib/install/dev
57
45
  - lib/install/install.rb
58
46
  - lib/install/package.json