middleman-tailwind 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c07df4a7208b891b2751dec5958122b63c2bf7b0935f3d0ff7f07549e0f97f90
4
+ data.tar.gz: 5d028688f5d39e7932a49bef17364cebfcb8f4e94a0a08f40080ca2fb78ad1b0
5
+ SHA512:
6
+ metadata.gz: 4d07f3d68082ab128e9563692bb0a71c8bb72533176e1ec6c9710fd59e0ceb0252e9a0dd95da9746dbe787b97b09a9b08070de0d4185b600ca6faaf3a2afb88c
7
+ data.tar.gz: 593747d347456462e2fedc51710ef1e733f980c53b8ad2d8df8f982eaaca83871bef22ae040191421ef5c07eff9603762d7656b8c844c659298a87748db15e14
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0.2
3
+ NewCops: enable
4
+ Exclude:
5
+ - "bin/**/*"
6
+ - "public/**/*"
7
+ - "log/**/*"
8
+ - "tmp/**/*"
9
+ - "vendor/**/*"
10
+ - "db/schema.rb"
11
+ - "db/migrate/**/*"
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Metrics/AbcSize:
17
+ Max: 22
18
+
19
+ Metrics/MethodLength:
20
+ Max: 16
21
+
22
+ Metrics/BlockLength:
23
+ Max: 30
24
+
25
+ Style/Documentation:
26
+ Enabled: false
27
+
28
+ Style/StringLiterals:
29
+ Enabled: true
30
+ EnforcedStyle: double_quotes
31
+
32
+ Style/StringLiteralsInInterpolation:
33
+ Enabled: true
34
+ EnforcedStyle: double_quotes
35
+
36
+ Style/FrozenStringLiteralComment:
37
+ Enabled: true
38
+ EnforcedStyle: never
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ## [0.1.0] - 2022-01-20
2
+
3
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in middleman-tailwind.gemspec
4
+ gemspec
5
+
6
+ gem "minitest", "~> 5.0"
7
+ gem "rake", "~> 13.0"
8
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,117 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ middleman-tailwind (0.1.0)
5
+ middleman-core (>= 4.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (6.1.4.4)
11
+ concurrent-ruby (~> 1.0, >= 1.0.2)
12
+ i18n (>= 1.6, < 2)
13
+ minitest (>= 5.1)
14
+ tzinfo (~> 2.0)
15
+ zeitwerk (~> 2.3)
16
+ addressable (2.8.0)
17
+ public_suffix (>= 2.0.2, < 5.0)
18
+ ast (2.4.2)
19
+ backports (3.23.0)
20
+ concurrent-ruby (1.1.9)
21
+ contracts (0.13.0)
22
+ dotenv (2.7.6)
23
+ erubis (2.7.0)
24
+ execjs (2.8.1)
25
+ fast_blank (1.0.1)
26
+ fastimage (2.2.6)
27
+ ffi (1.15.5)
28
+ hamster (3.0.0)
29
+ concurrent-ruby (~> 1.0)
30
+ hashie (3.6.0)
31
+ i18n (1.6.0)
32
+ concurrent-ruby (~> 1.0)
33
+ listen (3.0.8)
34
+ rb-fsevent (~> 0.9, >= 0.9.4)
35
+ rb-inotify (~> 0.9, >= 0.9.7)
36
+ memoist (0.16.2)
37
+ middleman-core (4.4.2)
38
+ activesupport (>= 6.1, < 7.0)
39
+ addressable (~> 2.4)
40
+ backports (~> 3.6)
41
+ bundler (~> 2.0)
42
+ contracts (~> 0.13.0)
43
+ dotenv
44
+ erubis
45
+ execjs (~> 2.0)
46
+ fast_blank
47
+ fastimage (~> 2.0)
48
+ hamster (~> 3.0)
49
+ hashie (~> 3.4)
50
+ i18n (~> 1.6.0)
51
+ listen (~> 3.0.0)
52
+ memoist (~> 0.14)
53
+ padrino-helpers (~> 0.15.0)
54
+ parallel
55
+ rack (>= 1.4.5, < 3)
56
+ sassc (~> 2.0)
57
+ servolux
58
+ tilt (~> 2.0.9)
59
+ toml
60
+ uglifier (~> 3.0)
61
+ webrick
62
+ minitest (5.15.0)
63
+ padrino-helpers (0.15.1)
64
+ i18n (>= 0.6.7, < 2)
65
+ padrino-support (= 0.15.1)
66
+ tilt (>= 1.4.1, < 3)
67
+ padrino-support (0.15.1)
68
+ parallel (1.21.0)
69
+ parser (3.1.0.0)
70
+ ast (~> 2.4.1)
71
+ parslet (2.0.0)
72
+ public_suffix (4.0.6)
73
+ rack (2.2.3)
74
+ rainbow (3.1.1)
75
+ rake (13.0.6)
76
+ rb-fsevent (0.11.0)
77
+ rb-inotify (0.10.1)
78
+ ffi (~> 1.0)
79
+ regexp_parser (2.2.0)
80
+ rexml (3.2.5)
81
+ rubocop (1.25.0)
82
+ parallel (~> 1.10)
83
+ parser (>= 3.1.0.0)
84
+ rainbow (>= 2.2.2, < 4.0)
85
+ regexp_parser (>= 1.8, < 3.0)
86
+ rexml
87
+ rubocop-ast (>= 1.15.1, < 2.0)
88
+ ruby-progressbar (~> 1.7)
89
+ unicode-display_width (>= 1.4.0, < 3.0)
90
+ rubocop-ast (1.15.1)
91
+ parser (>= 3.0.1.1)
92
+ ruby-progressbar (1.11.0)
93
+ sassc (2.4.0)
94
+ ffi (~> 1.9)
95
+ servolux (0.13.0)
96
+ tilt (2.0.10)
97
+ toml (0.3.0)
98
+ parslet (>= 1.8.0, < 3.0.0)
99
+ tzinfo (2.0.4)
100
+ concurrent-ruby (~> 1.0)
101
+ uglifier (3.2.0)
102
+ execjs (>= 0.3.0, < 3)
103
+ unicode-display_width (2.1.0)
104
+ webrick (1.7.0)
105
+ zeitwerk (2.5.3)
106
+
107
+ PLATFORMS
108
+ x86_64-linux
109
+
110
+ DEPENDENCIES
111
+ middleman-tailwind!
112
+ minitest (~> 5.0)
113
+ rake (~> 13.0)
114
+ rubocop (~> 1.21)
115
+
116
+ BUNDLED WITH
117
+ 2.3.5
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Johan Halse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Tailwind for Middleman
2
+
3
+ Probably the easiest way to get [Tailwind CSS](https://tailwindcss.com/) into your Middleman app! It comes bundled with the standalone CLI executables and is very point-and-shoot, no npm or external pipelines needed.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'middleman-tailwind'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install middleman-tailwind
20
+
21
+ ## Usage
22
+
23
+ If you don't have any special configuration needs, things should just work out of the box if you activate the extension in your `config.rb`:
24
+
25
+ ```ruby
26
+ activate :tailwind
27
+ ```
28
+
29
+ When you start your middleman server, a thread will spin up with the tailwind CLI in `watch` mode, watching for changes in all the `.erb` files under your `source` directory. The default path for your generated tailwind CSS file is `source/stylesheets/tailwind.css`, but you can change that with a configuration option:
30
+
31
+ ```ruby
32
+ activate :tailwind do |config|
33
+ config.destination_path = "source/stylesheets/another-filename.css"
34
+ end
35
+ ```
36
+
37
+ You might want to customize your tailwind.config.js. Tell middleman-tailwind where to find it with the following config option and it'll pick that up.
38
+
39
+ ```ruby
40
+ activate :tailwind do |config|
41
+ config.config_path = "tailwind.config.js"
42
+ end
43
+ ```
44
+
45
+ In the same vein, you can customize the application css that tailwind uses, like so:
46
+
47
+ ```ruby
48
+ activate :tailwind do |config|
49
+ config.css_path = "tailwind/application.tailwind.css"
50
+ end
51
+ ```
52
+
53
+ That's all. GLHF!
54
+
55
+ ## Development
56
+
57
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
58
+
59
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
60
+
61
+ ## Contributing
62
+
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/middleman-tailwind.
64
+
65
+ ## License
66
+
67
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/test_*.rb"]
8
+ end
9
+
10
+ require "rubocop/rake_task"
11
+
12
+ RuboCop::RakeTask.new
13
+
14
+ task default: %i[test rubocop]
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,15 @@
1
+ module Middleman
2
+ module Tailwind
3
+ module Upstream
4
+ VERSION = "v3.0.15".freeze
5
+
6
+ NATIVE_PLATFORMS = {
7
+ "arm64-darwin" => "tailwindcss-macos-arm64",
8
+ "x64-mingw32" => "tailwindcss-windows-x64.exe",
9
+ "x86_64-darwin" => "tailwindcss-macos-x64",
10
+ "x86_64-linux" => "tailwindcss-linux-x64",
11
+ "aarch64-linux" => "tailwindcss-linux-arm64"
12
+ }.freeze
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module Tailwind
3
+ VERSION = "0.1.0".freeze
4
+ end
5
+ end
@@ -0,0 +1,65 @@
1
+ require "middleman-core"
2
+ require_relative "tailwind/version"
3
+ require_relative "tailwind/upstream"
4
+
5
+ module Middleman
6
+ module Tailwind
7
+ class Error < StandardError; end
8
+
9
+ class Main < Middleman::Extension
10
+ option :config_path, nil, "Custom tailwind.config.js file path"
11
+ option :css_path, nil, "Tailwind source css file path"
12
+ option :destination_path, "source/stylesheets/tailwind.css", "Destination path for tailwind css"
13
+
14
+ def initialize(app, options_hash = {}, &block)
15
+ super
16
+
17
+ @gem_dir = File.expand_path "../..", __dir__
18
+ @project_dir = Dir.pwd
19
+ @config_path = options.config_path
20
+ @css_path = options.css_path
21
+ @destination_path = options.destination_path
22
+ end
23
+
24
+ def platform
25
+ %i[cpu os].map { |m| Gem::Platform.local.send(m) }.join("-")
26
+ end
27
+
28
+ def executable
29
+ Upstream::NATIVE_PLATFORMS[platform]
30
+ end
31
+
32
+ def application_css
33
+ return File.join(@project_dir, @css_path) if @css_path
34
+
35
+ File.join(@gem_dir, "tailwind/application.tailwind.css")
36
+ end
37
+
38
+ def destination
39
+ File.join(@project_dir, @destination_path)
40
+ end
41
+
42
+ def config_file
43
+ return File.join(@project_dir, @config_path) if @config_path
44
+
45
+ File.join(@gem_dir, "tailwind/tailwind.config.js")
46
+ end
47
+
48
+ def ready
49
+ exe = File.join(@gem_dir, "exe/#{executable}")
50
+ cmd = "#{exe} -c #{config_file} -i #{application_css} -o #{destination}"
51
+
52
+ if app.mode?(:server)
53
+ Thread.new do
54
+ system("#{cmd} -w", out: $stdout)
55
+ end
56
+ else
57
+ puts "Building Tailwind CSS..."
58
+ system(cmd, out: $stdout)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ ::Middleman::Extensions.register(:tailwind, Middleman::Tailwind::Main)
@@ -0,0 +1,13 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ /*
6
+
7
+ @layer components {
8
+ .btn-primary {
9
+ @apply py-2 px-4 bg-blue-200;
10
+ }
11
+ }
12
+
13
+ */
@@ -0,0 +1,5 @@
1
+ const defaultTheme = require("tailwindcss/defaultTheme");
2
+
3
+ module.exports = {
4
+ content: ["./source/**/*.erb"],
5
+ };
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-tailwind
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Johan Halse
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0
27
+ description: A Middleman extension that comes bundled with standalone executables,
28
+ no configuration needed.
29
+ email:
30
+ - johan@hal.se
31
+ executables:
32
+ - tailwindcss-linux-arm64
33
+ - tailwindcss-linux-x64
34
+ - tailwindcss-macos-arm64
35
+ - tailwindcss-macos-x64
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - ".rubocop.yml"
40
+ - CHANGELOG.md
41
+ - Gemfile
42
+ - Gemfile.lock
43
+ - LICENSE.txt
44
+ - README.md
45
+ - Rakefile
46
+ - exe/tailwindcss-linux-arm64
47
+ - exe/tailwindcss-linux-x64
48
+ - exe/tailwindcss-macos-arm64
49
+ - exe/tailwindcss-macos-x64
50
+ - lib/middleman/tailwind.rb
51
+ - lib/middleman/tailwind/upstream.rb
52
+ - lib/middleman/tailwind/version.rb
53
+ - tailwind/application.tailwind.css
54
+ - tailwind/tailwind.config.js
55
+ homepage: https://github.com/johanhalse/middleman-tailwind
56
+ licenses:
57
+ - MIT
58
+ metadata:
59
+ allowed_push_host: https://rubygems.org
60
+ homepage_uri: https://github.com/johanhalse/middleman-tailwind
61
+ source_code_uri: https://github.com/johanhalse/middleman-tailwind
62
+ changelog_uri: https://github.com/johanhalse/middleman-tailwind/CHANGELOG.md
63
+ rubygems_mfa_required: 'true'
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.0.0
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 3.3.3
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: The easiest way to get Tailwind CSS in your Middleman project
83
+ test_files: []