avo 2.14.2.pre.1 → 2.14.3.pre.2.tailwindcss
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/{avo.css → avo.base.css} +0 -0
- data/app/javascript/{avo.js → avo.base.js} +0 -0
- data/app/views/layouts/avo/application.html.erb +4 -4
- data/lib/avo/version.rb +1 -1
- data/lib/generators/avo/base_generator.rb +5 -1
- data/lib/generators/avo/tailwindcss/install_generator.rb +54 -0
- data/lib/generators/avo/templates/tailwindcss/Procfile.dev +2 -0
- data/lib/generators/avo/templates/tailwindcss/avo.tailwind.css +13 -0
- data/lib/tasks/avo_tasks.rake +8 -8
- data/lib/tasks/tailwindcss_rails.rake +24 -0
- data/public/avo-assets/{avo.css → avo.base.css} +0 -0
- data/public/avo-assets/{avo.js → avo.base.js} +1 -1
- data/public/avo-assets/{avo.js.map → avo.base.js.map} +1 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 000cbbb5361f9e2b283d18b20421f360e510f1320563fa480060035b31070d2c
|
4
|
+
data.tar.gz: ea51f134fedc9aacb232b4d5333d1d74807ffe93a32edc4daf46cc6c69cc0d3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a696a065e0af86bb02b9d1b44ac26cee640baeae95207528890a4be21a38496f7282f3609edf6d4458c4ec65357c4526553d20300d51562fd1a1ed271280b47b
|
7
|
+
data.tar.gz: 6f837374c20ef0a29b4382fefe9827de36f6c1543a9b7162c0ca9272d3fc1f99b4b5aff9823215f640711f86d9d33d106da69c819fcc111dc9d340361ad8bb78
|
data/Gemfile.lock
CHANGED
File without changes
|
File without changes
|
@@ -8,11 +8,11 @@
|
|
8
8
|
<%= render partial: 'avo/partials/javascript' %>
|
9
9
|
<%= render partial: 'avo/partials/head' %>
|
10
10
|
<% if Avo::PACKED %>
|
11
|
-
<%= javascript_include_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
12
|
-
<%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
|
11
|
+
<%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
|
12
|
+
<%= stylesheet_link_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
|
13
13
|
<% else %>
|
14
|
-
<%= javascript_include_tag "avo", "data-turbo-track": "reload", defer: true %>
|
15
|
-
<%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
|
14
|
+
<%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
|
15
|
+
<%= stylesheet_link_tag "avo.base", "data-turbo-track": "reload", defer: true %>
|
16
16
|
<% if Rails.env.development? %>
|
17
17
|
<%= javascript_include_tag "hotwire-livereload", defer: true %>
|
18
18
|
<% end %>
|
data/lib/avo/version.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "../base_generator"
|
2
|
+
|
3
|
+
module Generators
|
4
|
+
module Avo
|
5
|
+
module Tailwindcss
|
6
|
+
class InstallGenerator < BaseGenerator
|
7
|
+
source_root File.expand_path("../templates", __dir__)
|
8
|
+
|
9
|
+
namespace "avo:tailwindcss:install"
|
10
|
+
desc "Add Tailwindcss to your Avo project."
|
11
|
+
|
12
|
+
def create_files
|
13
|
+
unless tailwindcss_installed?
|
14
|
+
system "./bin/bundle add tailwindcss-rails"
|
15
|
+
system "./bin/rails tailwindcss:install"
|
16
|
+
end
|
17
|
+
|
18
|
+
unless Rails.root.join("app", "assets", "stylesheets", "avo.tailwind.css").exist?
|
19
|
+
say "Add default app/assets/stylesheets/avo.tailwind.css"
|
20
|
+
copy_file template_path("avo.tailwind.css"), "app/assets/stylesheets/avo.tailwind.css"
|
21
|
+
end
|
22
|
+
|
23
|
+
if Rails.root.join("Procfile.dev").exist?
|
24
|
+
append_to_file "Procfile.dev", "css: bin/rails avo:tailwindcss:watch\n"
|
25
|
+
else
|
26
|
+
say "Add default Procfile.dev"
|
27
|
+
copy_file template_path("Procfile.dev"), "Procfile.dev"
|
28
|
+
|
29
|
+
say "Ensure foreman is installed"
|
30
|
+
run "gem install foreman"
|
31
|
+
end
|
32
|
+
|
33
|
+
append_to_file "Procfile.dev", "avo_css: bin/rails tailwindcss:watch\n"
|
34
|
+
|
35
|
+
say "Ejecting the _head.html.erb partial"
|
36
|
+
Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
|
37
|
+
|
38
|
+
say "Adding the CSS asset to the partial"
|
39
|
+
prepend_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= stylesheet_link_tag \"avo.tailwind.css\", media: \"all\" %>"
|
40
|
+
end
|
41
|
+
|
42
|
+
no_tasks do
|
43
|
+
def template_path(filename)
|
44
|
+
Pathname.new(__dir__).join("..", "templates", "tailwindcss", filename).to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
def tailwindcss_installed?
|
48
|
+
Rails.root.join("config", "tailwind.config.js").exist? || Rails.root.join("tailwind.config.js").exist?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/tasks/avo_tasks.rake
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
# # Task goes here
|
4
4
|
# end
|
5
5
|
|
6
|
-
desc
|
7
|
-
task
|
8
|
-
spec = get_gem_spec
|
6
|
+
desc "Installs Avo assets and bundles them for when you want to use the GitHub repo in your app"
|
7
|
+
task "avo:build-assets" do
|
8
|
+
spec = get_gem_spec "avo"
|
9
9
|
# Uncomment to enable only when the source is github.com
|
10
10
|
# enabled = spec.source.to_s.include?('https://github.com/avo-hq/avo')
|
11
11
|
enabled = true
|
@@ -15,8 +15,8 @@ task 'avo:build-assets' do
|
|
15
15
|
path = spec.full_gem_path
|
16
16
|
|
17
17
|
Dir.chdir(path) do
|
18
|
-
system
|
19
|
-
system
|
18
|
+
system "yarn"
|
19
|
+
system "yarn prod:build"
|
20
20
|
end
|
21
21
|
|
22
22
|
puts "Done"
|
@@ -28,10 +28,10 @@ end
|
|
28
28
|
# From
|
29
29
|
# https://stackoverflow.com/questions/9322078/programmatically-determine-gems-path-using-bundler
|
30
30
|
def get_gem_spec(name)
|
31
|
-
spec = Bundler.load.specs.find{|s| s.name == name }
|
31
|
+
spec = Bundler.load.specs.find { |s| s.name == name }
|
32
32
|
raise GemNotFound, "Could not find gem '#{name}' in the current bundle." unless spec
|
33
|
-
if spec.name ==
|
34
|
-
return File.expand_path(
|
33
|
+
if spec.name == "bundler"
|
34
|
+
return File.expand_path("../../../", __FILE__)
|
35
35
|
end
|
36
36
|
|
37
37
|
spec
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Use the user provided asset or use the default
|
2
|
+
ASSET_FILE = ARGV[0] || "app/assets/builds/avo.tailwind.css"
|
3
|
+
# Se the tailwindcss-rails package name
|
4
|
+
TAILWINDCSS_RAILS = "tailwindcss-rails"
|
5
|
+
|
6
|
+
# Check if tailwindcss-rails is being used
|
7
|
+
if Gem.loaded_specs.key? TAILWINDCSS_RAILS
|
8
|
+
# Get the path
|
9
|
+
GEM_PATH = Gem.loaded_specs[TAILWINDCSS_RAILS].full_gem_path
|
10
|
+
# Compose the compile command
|
11
|
+
AVO_TAILWIND_COMPILE_COMMAND = "#{RbConfig.ruby} #{Pathname.new(GEM_PATH)}/exe/tailwindcss -i '#{Rails.root.join("app/assets/stylesheets/avo.css")}' -o '#{Rails.root.join(ASSET_FILE)}' -c '#{Rails.root.join("config/tailwind.config.js")}' --minify"
|
12
|
+
|
13
|
+
namespace "avo:tailwindcss" do
|
14
|
+
desc "Build your Tailwind CSS"
|
15
|
+
task :build do
|
16
|
+
system(AVO_TAILWIND_COMPILE_COMMAND, exception: true)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Watch and build your Tailwind CSS on file changes"
|
20
|
+
task :watch do
|
21
|
+
system "#{AVO_TAILWIND_COMPILE_COMMAND} -w"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
File without changes
|
@@ -510,4 +510,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
510
510
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
511
511
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
512
512
|
*/
|
513
|
-
//# sourceMappingURL=avo.js.map
|
513
|
+
//# sourceMappingURL=avo.base.js.map
|