cssbundling-rails 0.1.8 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/cssbundling/version.rb +1 -1
- data/lib/install/bulma/application.bulma.scss +39 -0
- data/lib/install/bulma/install.rb +7 -0
- data/lib/install/install.rb +8 -5
- data/lib/install/postcss/install.rb +2 -2
- data/lib/install/postcss/postcss.config.js +2 -6
- data/lib/tasks/cssbundling/build.rake +3 -1
- data/lib/tasks/cssbundling/install.rake +5 -0
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156d3acba9a6ae3277c785473df2fbae9d70d7f8ef482788e06f31374b9d5e86
|
4
|
+
data.tar.gz: 1f893bd6b9c04efae1b03206f41fd4bb85c38c7bca0728f7c9cc3daf105c8572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9e77967312dddbdee8ece958f1c612c02ff3a868be263842fd31ae430d0891be6ac185ade5e58f62cad5ca6251838b92d103c5471a8cc42bf31a082c46f04c1
|
7
|
+
data.tar.gz: b1345501f2328db87ba56d29572533fca2e93047eac2667c7ce6a8afd7d32306a03bbe05c8a2198c84f9a2bdad6908c2a4e116411a047623d2f702ccad6ace13
|
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
|
data/lib/cssbundling/version.rb
CHANGED
@@ -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")
|
data/lib/install/install.rb
CHANGED
@@ -1,10 +1,13 @@
|
|
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
|
-
|
7
|
-
|
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
13
|
append_to_file(".gitignore", %(\n/app/assets/builds/*\n!/app/assets/builds/.keep\n))
|
@@ -38,12 +41,12 @@ unless Rails.root.join("package.json").exist?
|
|
38
41
|
end
|
39
42
|
|
40
43
|
if Rails.root.join("Procfile.dev").exist?
|
41
|
-
append_to_file "Procfile.dev", "
|
44
|
+
append_to_file "Procfile.dev", "css: yarn build:css --watch\n"
|
42
45
|
else
|
43
46
|
say "Add default Procfile.dev"
|
44
47
|
copy_file "#{__dir__}/Procfile.dev", "Procfile.dev"
|
45
48
|
|
46
|
-
say "Ensure foreman is
|
49
|
+
say "Ensure foreman is installed"
|
47
50
|
run "gem install foreman"
|
48
51
|
end
|
49
52
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
say "Install PostCSS w/
|
1
|
+
say "Install PostCSS w/ nesting and autoprefixer"
|
2
2
|
copy_file "#{__dir__}/postcss.config.js", "postcss.config.js"
|
3
3
|
copy_file "#{__dir__}/application.postcss.css", "app/assets/stylesheets/application.postcss.css"
|
4
|
-
run "yarn add postcss postcss-cli postcss-
|
4
|
+
run "yarn add postcss postcss-cli postcss-nesting autoprefixer"
|
5
5
|
|
6
6
|
say "Add build:css script"
|
7
7
|
run %(npm set-script build:css "postcss ./app/assets/stylesheets/application.postcss.css -o ./app/assets/builds/application.css")
|
@@ -1,7 +1,9 @@
|
|
1
1
|
namespace :css do
|
2
2
|
desc "Build your CSS bundle"
|
3
3
|
task :build do
|
4
|
-
system "yarn install && yarn build:css"
|
4
|
+
unless system "yarn install && yarn build:css"
|
5
|
+
raise "cssbundling-rails: Command css:build failed, ensure yarn is installed and `yarn build:css` runs without errors"
|
6
|
+
end
|
5
7
|
end
|
6
8
|
end
|
7
9
|
|
@@ -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.
|
4
|
+
version: 0.2.3
|
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-
|
12
|
+
date: 2021-09-28 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
|