0.0.9-a • Published 5 months ago

shopify-juice v0.0.9-a

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Shopify Juice

Shopify Juice is a build tool designed to enhance the development experience for Shopify themes. It introduces a component system for .liquid files, allowing for a more modular and organized approach to theme development.

Setup

  1. Place your Shopify theme inside a folder named src.
  2. In your project root, run the tool using:
npx shopify-juice@latest

Pseudo-Subfolders

You can create any level of subfolders in the src directory. Shopify doesn't actually allow subfolders but with this system you can replace forward slashes in your path with underscores to refer to subdirectories. For example: src/assets/images/icon.png would compile in your build directory to build/assets/images_icon.png.

Using Components

  1. Create a .liquid file for your component inside any directory (e.g., src/app/Example.liquid).
  2. At the beginning of the component file, add the comment <!--component-->.
  3. Any content after this comment will be treated as the component's content.

src/components/Example.liquid

<!--component-->
<div class="my-component">
 Content of MyComponent goes here.
</div>

src/layout/theme.liquid

<Example/>

Output in build/layout/theme.liquid:

<div class="my-component">
 Content of MyComponent goes here.
</div>

Component with props example

Use <<propname>> syntax to add props to your components.

<!--component-->
<div class="my-component">
    Hello, <<name>>!
</div>

src/layout/theme.liquid

<Example name="adam"/>

Output in build/layout/theme.liquid:

<div class="my-component">
    Hello, adam!
</div>

Component with children example

Use reserved <<children>> to specify where children in a component go:

<!--component-->
<div class="my-component">
    <<children>>
</div>

src/layout/theme.liquid

<Example>
    Hello world
</Example>

Output in build/layout/theme.liquid:

<div class="my-component">
    Hello world
</div>
0.0.6-n

7 months ago

0.0.8-k

5 months ago

0.0.6-m

7 months ago

0.0.8-j

5 months ago

0.0.6-l

7 months ago

0.0.8-i

5 months ago

0.0.6-k

7 months ago

0.0.6-q

7 months ago

0.0.6-p

7 months ago

0.0.6-o

7 months ago

0.0.8-d

5 months ago

0.0.6-f

7 months ago

0.0.8-c

5 months ago

0.0.6-e

7 months ago

0.0.8-b

5 months ago

0.0.6-d

7 months ago

0.0.8-a

5 months ago

0.0.6-c

7 months ago

0.0.8-h

5 months ago

0.0.6-j

7 months ago

0.0.8-g

5 months ago

0.0.6-i

7 months ago

0.0.8-f

5 months ago

0.0.6-h

7 months ago

0.0.8-e

5 months ago

0.0.6-g

7 months ago

0.0.6-b

7 months ago

0.0.6-a

7 months ago

0.0.5-g

7 months ago

0.0.7-d

5 months ago

0.0.9-a

5 months ago

0.0.7-c

5 months ago

0.0.7-b

5 months ago

0.0.7-a

6 months ago

0.0.6-k-debug

7 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5-f

7 months ago

0.0.5-e

7 months ago

0.0.5-d

7 months ago

0.0.3-a

7 months ago

0.0.5-c

7 months ago

0.0.5-b

7 months ago

0.0.5-a

7 months ago

0.0.3-c

7 months ago

0.0.4-a

7 months ago

0.0.3-b

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.1-n

9 months ago

0.0.1-m

9 months ago

0.0.1-l

9 months ago

0.0.1-k

9 months ago

0.0.1-j

9 months ago

0.0.1-i

9 months ago

0.0.1-h

9 months ago

0.0.1-g

9 months ago

0.0.1-f

9 months ago

0.0.1-e

9 months ago

0.0.1-d

9 months ago

0.0.1-c

9 months ago

0.0.1-b

9 months ago

0.0.1-a

9 months ago

0.0.1

9 months ago