shopify_theme_builder 0.1.0 → 0.3.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 +4 -4
- data/README.md +26 -15
- data/exe/theme-builder +7 -0
- data/lib/shopify_theme_builder/command_line.rb +23 -0
- data/lib/shopify_theme_builder/version.rb +1 -1
- data/lib/shopify_theme_builder.rb +20 -2
- metadata +39 -4
- data/exe/theme-watcher +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 307e28c3c750b87460a048c082ba3c3287a480419c1b1c52faa84660de8b543a
|
|
4
|
+
data.tar.gz: 1ea87aa101f2858f46090e8f12d61c231bb4671dbd10aaa53b5427497690ae28
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4997036e87e815574d49b2857e4c8f859fcd53afcd279652ec3b81b563d454bd0826c21101a616c82cb8b0b570817e1c3d6d20a827c7d91d0940f81ed5d4766c
|
|
7
|
+
data.tar.gz: 199222a677430c7ec42719ef04574050327f61f8648c5096b7d60c9f06ac9a4c03b42fdbc90e307f41b46fd916eebb79fbac437a82c67ba00f87ce3805126279
|
data/README.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# ShopifyThemeBuilder
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
3
10
|
ShopifyThemeBuilder is a Ruby gem that facilitates the development of Shopify themes by enabling the use of a components folder where you can organize your files and separate liquid, JSON, CSS, JavaScript, comment and doc into a dedicated file. It watches for changes in your component folder and automatically compiles all files into Shopify-compatible Liquid templates.
|
|
4
11
|
|
|
5
12
|
## What problem does it solve?
|
|
@@ -32,6 +39,9 @@ blocks/
|
|
|
32
39
|
|
|
33
40
|
All files inside the `button` folder will be compiled into a single `button.liquid` file in the `blocks` folder, combining the comment, doc, Liquid, JSON, CSS, and JavaScript code.
|
|
34
41
|
|
|
42
|
+
## Tailwind CSS Support
|
|
43
|
+
|
|
44
|
+
ShopifyThemeBuilder also supports Tailwind CSS integration. You can specify an input CSS file that includes Tailwind directives and an output CSS file where the compiled styles will be saved. The watcher will automatically run the Tailwind build process whenever changes are detected in the components folder.
|
|
35
45
|
|
|
36
46
|
## Installation
|
|
37
47
|
|
|
@@ -46,27 +56,28 @@ bundle add shopify_theme_builder --group "development"
|
|
|
46
56
|
To watch for changes in the default components folder and build the theme, run:
|
|
47
57
|
|
|
48
58
|
```bash
|
|
49
|
-
bundle exec theme-
|
|
59
|
+
bundle exec theme-builder watch
|
|
50
60
|
```
|
|
51
61
|
|
|
52
|
-
You can customize
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
You can customize multiple options when running the watcher:
|
|
63
|
+
- `--folders`: Specify one or more folders to watch (default is `_components`).
|
|
64
|
+
- `--tailwind-input-file`: Specify the Tailwind CSS input file (default is `src/styles/tailwind.css`).
|
|
65
|
+
- `--tailwind-output-file`: Specify the Tailwind CSS output file (default is `assets/tailwind-output.css`).
|
|
66
|
+
- `--skip-tailwind`: Skip the Tailwind CSS build process (default is `false`).
|
|
57
67
|
|
|
58
|
-
If you
|
|
68
|
+
If you need help with all available options, or how to set them, run:
|
|
59
69
|
|
|
60
70
|
```bash
|
|
61
|
-
bundle
|
|
71
|
+
bundle exec theme-builder help watch
|
|
62
72
|
```
|
|
63
73
|
|
|
64
|
-
|
|
74
|
+
## After Running the Watcher
|
|
65
75
|
|
|
66
|
-
|
|
67
|
-
bin/theme-watcher
|
|
68
|
-
```
|
|
76
|
+
The watcher will create a CSS file that can be included in your Shopify theme layout in this way:
|
|
69
77
|
|
|
78
|
+
```liquid
|
|
79
|
+
{{ 'tailwind-output.css' | asset_url | stylesheet_tag }}
|
|
80
|
+
```
|
|
70
81
|
|
|
71
82
|
## Development
|
|
72
83
|
|
|
@@ -74,10 +85,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
74
85
|
|
|
75
86
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, run `bin/release VERSION`, which will update the version file, 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).
|
|
76
87
|
|
|
77
|
-
##
|
|
88
|
+
## Next Steps
|
|
78
89
|
|
|
79
|
-
- [
|
|
80
|
-
- [ ]
|
|
90
|
+
- [x] Run the tailwind build process automatically.
|
|
91
|
+
- [ ] Add Stimulus JS support.
|
|
81
92
|
- [ ] Create a command to build an example component with all the files.
|
|
82
93
|
- [ ] Decompile existing Shopify files into components structure (?).
|
|
83
94
|
|
data/exe/theme-builder
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "thor"
|
|
4
|
+
|
|
5
|
+
module ShopifyThemeBuilder
|
|
6
|
+
# CommandLine class to handle CLI commands using Thor.
|
|
7
|
+
class CommandLine < Thor
|
|
8
|
+
desc "watch", "Watch for changes in the components folder and build the theme accordingly"
|
|
9
|
+
method_option :folders, type: :array, default: ["_components"], desc: "Folders to watch for changes"
|
|
10
|
+
method_option :tailwind_input_file, type: :string, default: "./assets/tailwind.css", desc: "Tailwind CSS input file"
|
|
11
|
+
method_option :tailwind_output_file, type: :string, default: "./assets/tailwind-output.css",
|
|
12
|
+
desc: "Tailwind CSS output file"
|
|
13
|
+
method_option :skip_tailwind, type: :boolean, default: false, desc: "Skip Tailwind CSS processing"
|
|
14
|
+
def watch
|
|
15
|
+
ShopifyThemeBuilder.watch(
|
|
16
|
+
folders_to_watch: options[:folders],
|
|
17
|
+
tailwind_input_file: options[:tailwind_input_file],
|
|
18
|
+
tailwind_output_file: options[:tailwind_output_file],
|
|
19
|
+
skip_tailwind: options[:skip_tailwind]
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -6,16 +6,26 @@ require_relative "shopify_theme_builder/version"
|
|
|
6
6
|
require_relative "shopify_theme_builder/watcher"
|
|
7
7
|
require_relative "shopify_theme_builder/liquid_processor"
|
|
8
8
|
require_relative "shopify_theme_builder/builder"
|
|
9
|
+
require_relative "shopify_theme_builder/command_line"
|
|
9
10
|
|
|
10
11
|
# The main module for ShopifyThemeBuilder.
|
|
11
12
|
module ShopifyThemeBuilder
|
|
12
13
|
class << self
|
|
13
|
-
def watch(
|
|
14
|
+
def watch(
|
|
15
|
+
folders_to_watch: ["_components"],
|
|
16
|
+
tailwind_input_file: "./assets/tailwind.css",
|
|
17
|
+
tailwind_output_file: "./assets/tailwind-output.css",
|
|
18
|
+
skip_tailwind: false
|
|
19
|
+
)
|
|
14
20
|
create_folders(folders_to_watch)
|
|
15
21
|
|
|
16
22
|
initial_build(folders_to_watch)
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
run_tailwind(tailwind_input_file, tailwind_output_file) unless skip_tailwind
|
|
25
|
+
|
|
26
|
+
watch_folders(folders_to_watch) do
|
|
27
|
+
run_tailwind(tailwind_input_file, tailwind_output_file) unless skip_tailwind
|
|
28
|
+
end
|
|
19
29
|
end
|
|
20
30
|
|
|
21
31
|
private
|
|
@@ -46,7 +56,15 @@ module ShopifyThemeBuilder
|
|
|
46
56
|
|
|
47
57
|
Builder.new(files_to_process: [relative_filename]).build if relative_filename.start_with?(*folders_to_watch)
|
|
48
58
|
end
|
|
59
|
+
|
|
60
|
+
yield if block_given?
|
|
49
61
|
end
|
|
50
62
|
end
|
|
63
|
+
|
|
64
|
+
def run_tailwind(tailwind_input_file, tailwind_output_file)
|
|
65
|
+
puts "Running Tailwind CSS build..."
|
|
66
|
+
|
|
67
|
+
system("tailwindcss", "-i", tailwind_input_file, "-o", tailwind_output_file)
|
|
68
|
+
end
|
|
51
69
|
end
|
|
52
70
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shopify_theme_builder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Massimiliano Lattanzio
|
|
@@ -38,10 +38,44 @@ dependencies:
|
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '1.7'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: tailwindcss-ruby
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
- - "<"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '5.0'
|
|
51
|
+
type: :runtime
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - ">="
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '3.0'
|
|
58
|
+
- - "<"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '5.0'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: thor
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '1.4'
|
|
68
|
+
type: :runtime
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.4'
|
|
41
75
|
email:
|
|
42
76
|
- massimiliano.lattanzio@gmail.com
|
|
43
77
|
executables:
|
|
44
|
-
- theme-
|
|
78
|
+
- theme-builder
|
|
45
79
|
extensions: []
|
|
46
80
|
extra_rdoc_files: []
|
|
47
81
|
files:
|
|
@@ -49,9 +83,10 @@ files:
|
|
|
49
83
|
- LICENSE.txt
|
|
50
84
|
- README.md
|
|
51
85
|
- Rakefile
|
|
52
|
-
- exe/theme-
|
|
86
|
+
- exe/theme-builder
|
|
53
87
|
- lib/shopify_theme_builder.rb
|
|
54
88
|
- lib/shopify_theme_builder/builder.rb
|
|
89
|
+
- lib/shopify_theme_builder/command_line.rb
|
|
55
90
|
- lib/shopify_theme_builder/liquid_processor.rb
|
|
56
91
|
- lib/shopify_theme_builder/version.rb
|
|
57
92
|
- lib/shopify_theme_builder/watcher.rb
|
|
@@ -64,7 +99,7 @@ metadata:
|
|
|
64
99
|
bug_tracker_uri: https://github.com/nebulab/shopify_theme_builder/issues
|
|
65
100
|
homepage_uri: https://github.com/nebulab/shopify_theme_builder?tab=readme-ov-file#readme
|
|
66
101
|
source_code_uri: https://github.com/nebulab/shopify_theme_builder
|
|
67
|
-
changelog_uri: https://github.com/nebulab/
|
|
102
|
+
changelog_uri: https://github.com/nebulab/shopify_theme_builder/releases
|
|
68
103
|
rubygems_mfa_required: 'true'
|
|
69
104
|
rdoc_options: []
|
|
70
105
|
require_paths:
|
data/exe/theme-watcher
DELETED