tailwindcss-rails-webpacker 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 30d593306437e185c7a083f997b9033626d697832b0966e047634d9a66bfeb75
4
+ data.tar.gz: f311e36446b9ccb068e75da6aa47c76c26f8b494b339e10e5f6b1de845d58465
5
+ SHA512:
6
+ metadata.gz: d3d1e36e3c31710e7643647424ca6260496e3b5d3880ab6d882a026bd3aee7cf05a77c57a3df5771582e3772e2dccb029283f15ca75c91c2e4acbe18c1da564b
7
+ data.tar.gz: eb01e0c14c81ad2eb635bb59043740e3d925fbfcfaf21e1f4095d848fdf0eb1b5e14be7d08020549cfccf88337476e835061c4ae73b9d7cafe2b7f6aa3ab5014
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 Dino Maric
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # Tailwind CSS for Rails webpacker
2
+
3
+ [Tailwind CSS](https://tailwindcss.com) is a utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.
4
+
5
+ This gem gives access to the standard Tailwind CSS framework configured for Rails webpacker.
6
+
7
+ This is extraction originally created inside the [tailwindcss-rails](https://github.com/rails/tailwindcss-rails) gem.
8
+
9
+
10
+ ## Installation
11
+
12
+ 1. Run `./bin/bundle add tailwindcss-rails-webpacker`
13
+ 2. Run `./bin/rails tailwindcss:install`
14
+
15
+
16
+ ## License
17
+
18
+ Tailwind for Rails is released under the [MIT License](https://opensource.org/licenses/MIT).
19
+ Tailwind CSS is released under the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ require "rake/testtask"
6
+
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'test'
9
+ t.pattern = 'test/**/*_test.rb'
10
+ t.verbose = false
11
+ end
12
+
13
+ task default: :test
@@ -0,0 +1,3 @@
1
+ @import "tailwindcss/base";
2
+ @import "tailwindcss/components";
3
+ @import "tailwindcss/utilities";
@@ -0,0 +1,22 @@
1
+ WEBPACK_STYLESHEETS_PATH = "#{Webpacker.config.source_path}/stylesheets"
2
+ APPLICATION_LAYOUT_PATH = Rails.root.join("app/views/layouts/application.html.erb")
3
+
4
+ say "Installing Tailwind CSS"
5
+ run "yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9"
6
+ insert_into_file "#{Webpacker.config.source_entry_path}/application.js", "\nimport \"stylesheets/application\"\n"
7
+
8
+ say "Configuring Tailwind CSS"
9
+ directory Pathname.new(__dir__).join("stylesheets"), Webpacker.config.source_path.join("stylesheets")
10
+ Dir.chdir(WEBPACK_STYLESHEETS_PATH) { run "npx tailwindcss init" }
11
+
12
+ insert_into_file "postcss.config.js", "require('tailwindcss')(\"./app/javascript/stylesheets/tailwind.config.js\"),\n ",
13
+ before: "require('postcss-import')"
14
+
15
+
16
+ if APPLICATION_LAYOUT_PATH.exist?
17
+ say "Add Tailwindcss include tags in application layout"
18
+ insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s, %(\n <%= stylesheet_pack_tag "application", "data-turbo-track": "reload" %>), before: /\s*<\/head>/
19
+ else
20
+ say "Default application.html.erb is missing!", :red
21
+ say %( Add <%= stylesheet_pack_tag "application", "data-turbo-track": "reload" %> within the <head> tag in your custom layout.)
22
+ end
@@ -0,0 +1,5 @@
1
+ module Tailwindcss
2
+ end
3
+
4
+ require "tailwindcss/version"
5
+ require "tailwindcss/engine"
@@ -0,0 +1,4 @@
1
+ module Tailwindcss
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module Tailwindcss
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ namespace :tailwindcss do
2
+ desc "Install Tailwind CSS into the app"
3
+ task :install do
4
+ system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{File.expand_path("../install/tailwindcss.rb", __dir__)}"
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tailwindcss-rails-webpacker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dino Maric
8
+ - David Heinemeier Hansson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2021-08-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 6.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 6.0.0
28
+ description:
29
+ email:
30
+ - dinom@hey.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - lib/install/stylesheets/application.scss
39
+ - lib/install/tailwindcss.rb
40
+ - lib/tailwindcss-rails-webpacker.rb
41
+ - lib/tailwindcss/engine.rb
42
+ - lib/tailwindcss/version.rb
43
+ - lib/tasks/tailwindcss_tasks.rake
44
+ homepage: https://github.com/WizardComputer/tailwindcss-rails-webpacker
45
+ licenses:
46
+ - MIT
47
+ metadata:
48
+ homepage_uri: https://github.com/WizardComputer/tailwindcss-rails-webpacker
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.1.6
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Integrate Tailwind CSS with the Rails webpacker.
68
+ test_files: []