bridgetown-plugin-tailwindcss 0.1.1 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d5e2e373904f9caa02ee47316ab35c76744ebca284ced01dc71b2d7fad4f3cc
4
- data.tar.gz: 4e62c17fa8e0b04aa4408b26f92fbd8218fa41cdf2c7decf62e5e17bac0601f7
3
+ metadata.gz: 6907ae8359a1375066abb794044ba83dacd561ddfd981200134e9958b02e36dc
4
+ data.tar.gz: d6a1ba20c529991a1c8778b54c3de218dc6710f69070066b7a8a8ccb38e17851
5
5
  SHA512:
6
- metadata.gz: 55121446f16f24522967ce1d954f074d12a7d2b10e73a6285965f3439f3310190a2f593716eefe6daf2493d76afd12bca70ab2688f72ca8d48cc4501f0772c01
7
- data.tar.gz: 843ec500c453cc1975a5980c3409c1530ecd38781ada5f3d71cbb330759aab32bffb393a50a8e616fda5c3b9c2ab5122125cf22318ce924e1e572d8576f40d63
6
+ metadata.gz: 3cbc34000352ca5d2e28d5357ab44cde6c6f3d4971df7d7e9947272a45b955a516b720f5a05df82ea97e3dd8cecc2d615b4fccef37f7e30aa99f3246a77becf2
7
+ data.tar.gz: ccbd01c59e859158372c934a08024934f4943e154824bcc3a6f4b4739804d42f25c4bf6a59057e23b3e872578a74a6dee40c9d596e747fd997bb3106043e2cba
data/Rakefile CHANGED
@@ -9,10 +9,14 @@ RSpec::Core::RakeTask.new(:spec)
9
9
  task :default => :spec
10
10
  task :test => :spec
11
11
 
12
- task :release do
12
+ task :deploy do
13
13
  Rake.sh "./script/release"
14
14
  end
15
15
 
16
+ task :format do
17
+ Rake.sh "./script/fmt -a"
18
+ end
19
+
16
20
 
17
21
  namespace :bump do
18
22
  task :current do
@@ -5,10 +5,10 @@ require_relative "lib/bridgetown-plugin-tailwindcss/version"
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "bridgetown-plugin-tailwindcss"
7
7
  spec.version = TailwindCss::VERSION
8
- spec.author = "Bridgetown Team"
9
- spec.email = "maintainers@bridgetownrb.com"
10
- spec.summary = "Sample code for creating new Bridgetown plugins"
11
- spec.homepage = "https://github.com/bridgetownrb/bridgetown-plugin-tailwindcss"
8
+ spec.author = "Konnor Rogers"
9
+ spec.email = "konnor7414@gmail.com"
10
+ spec.summary = "A plugin to add tailwindcss to a site"
11
+ spec.homepage = "https://github.com/paramagicdev/bridgetown-plugin-tailwindcss"
12
12
  spec.license = "MIT"
13
13
 
14
14
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bridgetown"
4
- require 'bridgetown-plugin-tailwindcss/command.rb'
5
- require 'bridgetown-plugin-tailwindcss/utils.rb'
4
+ require "bridgetown-plugin-tailwindcss/command.rb"
5
+ require "bridgetown-plugin-tailwindcss/utils.rb"
6
6
 
7
7
  Bridgetown::PluginManager.new_source_manifest(
8
- origin: TailwindCss,
8
+ origin: TailwindCss
9
9
  )
@@ -1,104 +1,170 @@
1
- require 'bridgetown'
2
- require_relative 'utils'
1
+ # frozen_string_literal: true
3
2
 
4
- class TailwindInit < Bridgetown::Command
5
- ACTIONS = TailwindCss::Utils::Actions.new
3
+ require "bridgetown"
4
+ require_relative "utils"
6
5
 
7
- class << self
8
- def init_with_program(prog)
9
- prog.command(:tailwind_init) do |c|
10
- c.syntax "tailwind_init"
11
- c.description 'Initialize config for Tailwind'
12
- # c.option 'path', '--path', 'Choose the path to install tailwind'
6
+ module Bridgetown
7
+ module Commands
8
+ class TailwindInit < Bridgetown::Command
9
+ ACTIONS = TailwindCss::Utils::Actions.new
13
10
 
14
- c.action do |args, options|
15
- Bridgetown::Commands::TailwindInit.new.run
11
+ class << self
12
+ def init_with_program(prog)
13
+ prog.command(:tailwind_init) do |c|
14
+ c.syntax "tailwind_init"
15
+ c.description "Initialize config for Tailwind"
16
+ # c.option 'path', '--path', 'Choose the path to install tailwind'
17
+
18
+ c.action do |_args, _options|
19
+ run
20
+ end
21
+ end
16
22
  end
17
- end
18
- end
19
23
 
20
- private
24
+ private
21
25
 
22
- def run
23
- write_files
24
- end
26
+ def run
27
+ write_files
28
+ end
25
29
 
30
+ def write_files
31
+ webpack_config = File.expand_path("webpack.config.js")
32
+ tailwind_config = File.expand_path("tailwind.config.js")
26
33
 
27
- def write_files
28
- webpack_config = File.expand_path("webpack.config.js")
29
- tailwind_config = File.expand_path("tailwind.config.js")
34
+ ACTIONS.create_file(webpack_config, webpack_file_contents)
35
+ ACTIONS.create_file(tailwind_config, tailwind_config_contents)
36
+ prepend_to_stylesheet
37
+ end
30
38
 
31
- ACTIONS.create_file(webpack_config, webpack_file_contents)
32
- ACTIONS.create_file(tailwind_config, tailwind_config_contents)
33
- prepend_to_stylesheet
34
- end
39
+ def prepend_to_stylesheet
40
+ frontend_stylesheet = File.join("frontend", "styles", "index.scss")
41
+ frontend_stylesheet = File.expand_path(frontend_stylesheet)
35
42
 
36
- def prepend_to_stylesheet
37
- frontend_stylesheet = File.join("frontend", "styles", "index.scss")
38
- frontend_stylesheet = File.expand_path(frontend_stylesheet)
43
+ return unless File.exist?(frontend_stylesheet)
39
44
 
40
- return unless File.exist?(frontend_stylesheet)
45
+ ACTIONS.prepend_to_file(frontend_stylesheet, import_tailwind_contents)
46
+ end
41
47
 
42
- ACTIONS.prepend_to_file(frontend_stylesheet, import_tailwind_contents)
43
- end
48
+ def import_tailwind_contents
49
+ <<~IMPORT
50
+ @import 'tailwindcss/base';
51
+ @import 'tailwindcss/components';
52
+ @import 'tailwindcss/utilities';
44
53
 
45
- def import_tailwind_contents
46
- <<~IMPORT
47
- @import 'tailwindcss/base';
48
- @import 'tailwindcss/components';
49
- @import 'tailwindcss/utilities';
50
- IMPORT
51
- end
54
+ IMPORT
55
+ end
52
56
 
53
- def tailwind_config_contents
54
- <<~TAILWIND
55
- module.exports = {
56
- purge: {
57
- enabled: true,
58
- content: ['./src/**/*.html'],
59
- },
60
- theme: {
61
- extend: {},
62
- },
63
- variants: {},
64
- plugins: [],
65
- }
66
- TAILWIND
67
- end
57
+ def tailwind_config_contents
58
+ <<~TAILWIND
59
+ module.exports = {
60
+ purge: {
61
+ enabled: true,
62
+ content: ['./src/**/*.html'],
63
+ },
64
+ theme: {
65
+ extend: {},
66
+ },
67
+ variants: {},
68
+ plugins: [],
69
+ }
70
+ TAILWIND
71
+ end
72
+
73
+ def webpack_file_contents
74
+ <<~WEBPACK
75
+ const path = require("path");
76
+ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
77
+ const ManifestPlugin = require("webpack-manifest-plugin");
68
78
 
69
- def webpack_file_contents
70
- <<~WEBPACK
71
- {
72
- test: /\.(s[ac]|c)ss$/,
73
- use: [
74
- MiniCssExtractPlugin.loader,
75
- "css-loader",
76
- {
77
- loader: "sass-loader",
78
- options: {
79
- sassOptions: {
80
- includePaths: [
81
- path.resolve(__dirname, "src/_components"),
82
- path.resolve(__dirname, "src/_includes"),
83
- ],
84
- },
79
+ module.exports = {
80
+ entry: "./frontend/javascript/index.js",
81
+ devtool: "source-map",
82
+ // Set some or all of these to true if you want more verbose logging:
83
+ stats: {
84
+ modules: false,
85
+ builtAt: false,
86
+ timings: false,
87
+ children: false,
88
+ },
89
+ output: {
90
+ path: path.resolve(__dirname, "output", "_bridgetown", "static", "js"),
91
+ filename: "all.[contenthash].js",
85
92
  },
86
- },
87
- {
88
- loader: "postcss-loader",
89
- options: {
90
- ident: "postcss",
91
- plugins: [
92
- require("postcss-import"),
93
- require("tailwindcss"),
94
- require("autoprefixer"),
93
+ resolve: {
94
+ extensions: [".js", ".jsx"],
95
+ },
96
+ plugins: [
97
+ new MiniCssExtractPlugin({
98
+ filename: "../css/all.[contenthash].css",
99
+ }),
100
+ new ManifestPlugin({
101
+ fileName: path.resolve(__dirname, ".bridgetown-webpack", "manifest.json"),
102
+ }),
103
+ ],
104
+ module: {
105
+ rules: [
106
+ {
107
+ test: /\.(js|jsx)/,
108
+ use: {
109
+ loader: "babel-loader",
110
+ options: {
111
+ presets: ["@babel/preset-env"],
112
+ plugins: [
113
+ "@babel/plugin-proposal-class-properties",
114
+ [
115
+ "@babel/plugin-transform-runtime",
116
+ {
117
+ helpers: false,
118
+ },
119
+ ],
120
+ ],
121
+ },
122
+ },
123
+ },
124
+ {
125
+ test: /\.(s[ac]|c)ss$/,
126
+ use: [
127
+ MiniCssExtractPlugin.loader,
128
+ "css-loader",
129
+ {
130
+ loader: "sass-loader",
131
+ options: {
132
+ sassOptions: {
133
+ includePaths: [
134
+ path.resolve(__dirname, "src/_components"),
135
+ path.resolve(__dirname, "src/_includes"),
136
+ ],
137
+ },
138
+ },
139
+ },
140
+ ],
141
+ },
142
+ {
143
+ loader: "postcss-loader",
144
+ options: {
145
+ ident: "postcss",
146
+ plugins: [
147
+ require("postcss-import"),
148
+ require("tailwindcss"),
149
+ require("autoprefixer"),
150
+ ],
151
+ },
152
+ },
153
+ {
154
+ test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/,
155
+ loader: "file-loader",
156
+ options: {
157
+ outputPath: "../fonts",
158
+ publicPath: "../fonts",
159
+ },
160
+ },
95
161
  ],
96
162
  },
97
- },
98
- ],
99
- },
100
- WEBPACK
163
+ };
164
+
165
+ WEBPACK
166
+ end
167
+ end
101
168
  end
102
169
  end
103
170
  end
104
-
@@ -1,4 +1,6 @@
1
- require 'thor'
1
+ # frozen_string_literal: true
2
+
3
+ require "thor"
2
4
 
3
5
  module TailwindCss
4
6
  module Utils
@@ -10,9 +12,14 @@ module TailwindCss
10
12
  class Bump < Thor
11
13
  include Thor::Actions
12
14
 
13
- VERSION_REGEX = /(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/
15
+ RUBY_VERSION_REGEX = %r!(.*VERSION.?=.*)!.freeze
16
+ NPM_VERSION_REGEX = %r!(.*"version":.*)!.freeze
17
+ VERSION_LINE = Regexp.union(RUBY_VERSION_REGEX, NPM_VERSION_REGEX)
18
+ VERSION_REGEX = %r!(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)!.freeze
19
+ GSUB_REGEX = %r!(?<version>#{VERSION_LINE})#{VERSION_REGEX}!.freeze
14
20
 
15
- no_commands {
21
+ # rubocop:disable Metrics/BlockLength
22
+ no_commands do
16
23
  def current_version
17
24
  VERSION
18
25
  end
@@ -20,44 +27,58 @@ module TailwindCss
20
27
  def bump_version_to_string(string)
21
28
  say("Bumping from #{VERSION} to #{string}", :red)
22
29
 
30
+ match = GSUB_REGEX.match(File.read(file))
31
+ gsub_string = "#{match[:version]}#{string}"
23
32
  version_files.each do |file|
24
- gsub_file(file, VERSION_REGEX, string)
33
+ gsub_file(file, GSUB_REGEX, gsub_string)
25
34
  end
26
35
  end
27
36
 
28
- def bump_version(type, version: VERSION, value: nil)
29
- say(version_change(type, version: version, value: value), :red)
30
-
37
+ def bump_version(type, version: VERSION)
38
+ say(version_change(type, version: version), :red)
31
39
 
32
40
  version_files.each do |file|
33
- gsub_file(file, VERSION_REGEX,
34
- to_version(type, version: version, value: value))
41
+ match = GSUB_REGEX.match(File.read(file))
42
+ gsub_string = "#{match[:version]}#{to_version(type, version: version)}"
43
+
44
+ gsub_file(file, GSUB_REGEX,
45
+ gsub_string)
35
46
  end
36
47
  end
37
48
 
38
49
  private
39
50
 
51
+ def gsub_match(file)
52
+ GSUB_REGEX.match(File.read(file))
53
+ end
54
+
40
55
  def version_files
41
- @package_json = File.expand_path("package.json")
42
- @version_file = File.expand_path(File.join(__dir__, "version.rb"))
56
+ package_json = File.expand_path("package.json")
57
+ version_file = File.expand_path(File.join(__dir__, "version.rb"))
43
58
 
44
- [ @package_json, @version_file ]
59
+ [package_json, version_file]
45
60
  end
46
61
 
47
- def to_version(type, version: nil, value: nil)
62
+ # ef version_replacement
63
+ # match = GSUB_REGEX.match(File.readlines
64
+ # end
65
+
66
+ def to_version(type, version: nil)
48
67
  from = version
49
68
  match = VERSION_REGEX.match(from)
50
69
 
51
70
  groups = {
52
71
  major: match[:major],
53
72
  minor: match[:minor],
54
- patch: match[:patch]
73
+ patch: match[:patch],
55
74
  }
56
75
 
57
- raise "\nYou gave #{type} but the only accepted types are
58
- #{groups.keys}" unless groups.keys.include?(type)
76
+ unless groups.key?(type)
77
+ raise "\nYou gave #{type} but the only accepted types are
78
+ #{groups.keys}"
79
+ end
59
80
 
60
- groups[type] = value || (groups[type].to_i + 1).to_s
81
+ groups[type] = (groups[type].to_i + 1).to_s
61
82
 
62
83
  bump_to_zero(type, groups)
63
84
 
@@ -74,10 +95,11 @@ module TailwindCss
74
95
  groups[:minor] = "0"
75
96
  end
76
97
 
77
- def version_change(type, version: nil, value: nil)
78
- "Bumping from #{version} to #{to_version(type, version: version, value: value)}"
98
+ def version_change(type, version: nil)
99
+ "Bumping from #{version} to #{to_version(type, version: version)}"
79
100
  end
80
- }
101
+ end
102
+ # rubocop:enable Metrics/BlockLength
81
103
  end
82
104
  end
83
105
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindCss
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.12"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bridgetown-plugin-tailwindcss",
3
- "version": "0.1.1",
3
+ "version": "0.1.12",
4
4
  "main": "frontend/javascript/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,9 +13,9 @@
13
13
  "files": [
14
14
  "frontend"
15
15
  ],
16
- "devDependencies": {
17
- "postcss-import": "^0.1.1",
18
- "postcss-loader": "^0.1.1",
19
- "tailwindcss": "^0.1.1"
16
+ "dependencies": {
17
+ "postcss-import": "^12.0.1",
18
+ "postcss-loader": "^3.0.0",
19
+ "tailwindcss": "^1.4.6"
20
20
  }
21
21
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-plugin-tailwindcss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
- - Bridgetown Team
7
+ - Konnor Rogers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-31 00:00:00.000000000 Z
11
+ date: 2020-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown
@@ -115,7 +115,7 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0.2'
117
117
  description:
118
- email: maintainers@bridgetownrb.com
118
+ email: konnor7414@gmail.com
119
119
  executables: []
120
120
  extensions: []
121
121
  extra_rdoc_files: []
@@ -136,11 +136,11 @@ files:
136
136
  - package.json
137
137
  - tags
138
138
  - yarn.lock
139
- homepage: https://github.com/bridgetownrb/bridgetown-plugin-tailwindcss
139
+ homepage: https://github.com/paramagicdev/bridgetown-plugin-tailwindcss
140
140
  licenses:
141
141
  - MIT
142
142
  metadata:
143
- yarn-add: bridgetown-plugin-tailwindcss@0.1.1
143
+ yarn-add: bridgetown-plugin-tailwindcss@0.1.12
144
144
  post_install_message:
145
145
  rdoc_options: []
146
146
  require_paths:
@@ -159,5 +159,5 @@ requirements: []
159
159
  rubygems_version: 3.0.3
160
160
  signing_key:
161
161
  specification_version: 4
162
- summary: Sample code for creating new Bridgetown plugins
162
+ summary: A plugin to add tailwindcss to a site
163
163
  test_files: []