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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b2dd6f882eac9d9271bbb4824fb9fb71bad9c77c7fa1e71df410cb9b4aeb54f
4
- data.tar.gz: 32a04dae63c3694152bcc9b531d4d323e135b2440becd4a33f721ad9f351b1c5
3
+ metadata.gz: 000cbbb5361f9e2b283d18b20421f360e510f1320563fa480060035b31070d2c
4
+ data.tar.gz: ea51f134fedc9aacb232b4d5333d1d74807ffe93a32edc4daf46cc6c69cc0d3b
5
5
  SHA512:
6
- metadata.gz: 5cee10bf690be47c5151cf6d00d1ddff9c32c0f3306be7b99962477e1d61c731dca473bcca93cce2eeea9a7ee4b0fe27ba160fe45548ae7042b900b0a9711f3f
7
- data.tar.gz: 12267b7e20da3cd91c971e4b86d7ee872cb584eee965b9e8c7c92bc3235a42b17a0ea75b25d30abd694647548341300a1342bb383b800cb6dca9b3e7134e2c26
6
+ metadata.gz: a696a065e0af86bb02b9d1b44ac26cee640baeae95207528890a4be21a38496f7282f3609edf6d4458c4ec65357c4526553d20300d51562fd1a1ed271280b47b
7
+ data.tar.gz: 6f837374c20ef0a29b4382fefe9827de36f6c1543a9b7162c0ca9272d3fc1f99b4b5aff9823215f640711f86d9d33d106da69c819fcc111dc9d340361ad8bb78
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.14.2.pre.1)
4
+ avo (2.14.3.pre.2.tailwindcss)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
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
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.14.2.pre.1" unless const_defined?(:VERSION)
2
+ VERSION = "2.14.3.pre.2.tailwindcss" unless const_defined?(:VERSION)
3
3
  end
@@ -7,7 +7,11 @@ module Generators
7
7
 
8
8
  def initialize(*args)
9
9
  super(*args)
10
- invoke "avo:version", *args
10
+
11
+ # Don't output the version if requested so
12
+ unless args.include?(["--no-avo-version"])
13
+ invoke "avo:version", *args
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -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
@@ -0,0 +1,2 @@
1
+ web: bin/rails server -p 3000
2
+ css: bin/rails avo:tailwindcss:watch
@@ -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
+ */
@@ -3,9 +3,9 @@
3
3
  # # Task goes here
4
4
  # end
5
5
 
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'
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 'yarn'
19
- system 'yarn prod:build'
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 == 'bundler'
34
- return File.expand_path('../../../', __FILE__)
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