@upstatement/twix-darwin-x64 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. package/bin/twix +0 -0
  2. package/package.json +7 -24
  3. package/README.md +0 -162
package/bin/twix CHANGED
Binary file
package/package.json CHANGED
@@ -1,31 +1,14 @@
1
1
  {
2
2
  "name": "@upstatement/twix-darwin-x64",
3
- "version": "0.1.4",
4
- "description": "An opinionated formatter for Twig templating engine",
5
- "bin": {
6
- "twix": "bin/twix"
7
- },
8
- "os": [
9
- "darwin"
10
- ],
11
- "cpu": [
12
- "x64"
13
- ],
3
+ "version": "0.1.5",
4
+ "description": "Platform-specific binary for @upstatement/twix (darwin-x64)",
5
+ "os": ["darwin"],
6
+ "cpu": ["x64"],
7
+ "files": ["bin/"],
14
8
  "repository": {
15
9
  "type": "git",
16
10
  "url": "git+https://github.com/Upstatement/twix.git"
17
11
  },
18
- "keywords": [
19
- "twig",
20
- "formatter",
21
- "html",
22
- "template",
23
- "craft"
24
- ],
25
12
  "author": "Upstatement",
26
- "license": "MIT",
27
- "bugs": {
28
- "url": "https://github.com/Upstatement/twix/issues"
29
- },
30
- "homepage": "https://github.com/Upstatement/twix#readme"
31
- }
13
+ "license": "MIT"
14
+ }
package/README.md DELETED
@@ -1,162 +0,0 @@
1
- # Twix 🌱🍫
2
-
3
- An opinionated formatter for [Twig](https://twig.symfony.com/) templating engine. **Entirely coded with Claude.**
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install --save-dev @upstatement/twix
9
- ```
10
-
11
- Or download the binary directly from [GitHub Releases](https://github.com/Upstatement/twix/releases).
12
-
13
- ## Usage
14
-
15
- ```bash
16
- # Format a file (in-place)
17
- twix path/to/file.twig
18
-
19
- # Format multiple files
20
- twix "src/**/*.twig"
21
-
22
- # Check if files are formatted (exit 1 if not)
23
- twix --check path/to/file.twig
24
-
25
- # Format from stdin
26
- cat file.twig | twix --stdin
27
- ```
28
-
29
- ## Configuration
30
-
31
- Create a `.twixrc.json` or `twix.config.json` file in your project root:
32
-
33
- ```json
34
- {
35
- "indentSize": 2,
36
- "indentStyle": "space",
37
- "printWidth": 80,
38
- "customTags": {
39
- "block": ["if"],
40
- "inline": ["set"],
41
- "intermediate": ["else"]
42
- }
43
- }
44
- ```
45
-
46
- ### Options
47
-
48
- | Option | Type | Default | Description |
49
- | ------------------------- | -------- | --------- | ------------------------------------------------------------------------- |
50
- | `indentSize` | number | `2` | Number of spaces or tabs per indentation level |
51
- | `indentStyle` | string | `"space"` | Use `"space"` or `"tab"` for indentation |
52
- | `printWidth` | number | `80` | Maximum line width before wrapping attributes |
53
- | `customTags.block` | string[] | `[]` | Custom Twig block tags (tags with bodies, e.g., `{% if %}...{% endif %}`) |
54
- | `customTags.inline` | string[] | `[]` | Custom Twig inline tags (self-closing, e.g., `{% set = ... %}`) |
55
- | `customTags.intermediate` | string[] | `[]` | Custom intermediate tags (like `{% else %}` or `{% case %}`) |
56
-
57
- ### Built-in Tag Support
58
-
59
- **Block tags** (have a body and `{% end* %}` tag):
60
-
61
- - Standard Twig: `if`, `for`, `block`, `set`, `apply`, `autoescape`, `embed`, `filter`, `macro`, `sandbox`, `verbatim`, `with`
62
- - Craft CMS: `switch`, `cache`, `js`, `css`, `nav`, `paginate`, `tag`
63
-
64
- **Inline tags** (self-closing):
65
-
66
- - Standard Twig: `extends`, `include`, `use`, `import`, `from`, `do`, `flush`, `deprecated`
67
- - Craft CMS: `exit`, `header`, `redirect`, `requireLogin`, `requireAdmin`, `requireGuest`, `requirePermission`
68
-
69
- **Intermediate tags** (appear within blocks):
70
-
71
- - `else`, `elseif`, `case`, `default`
72
-
73
- ## Features
74
-
75
- ### HTML Formatting
76
-
77
- - Proper indentation of nested elements
78
- - Block elements (`div`, `p`, `section`, etc.) get their own lines
79
- - Inline elements (`span`, `a`, `strong`, etc.) stay on the same line when possible
80
- - Void elements (`meta`, `link`, `input`, etc.) are self-closing
81
- - Multi-line attribute formatting when attributes exceed `printWidth`
82
-
83
- ### Twig Formatting
84
-
85
- - Block tags are indented with their content
86
- - Expressions (`{{ }}`) preserve their content
87
- - Whitespace control modifiers (`{%- -%}`, `{{- -}}`) are preserved
88
- - Comments (`{# #}`) are preserved
89
-
90
- ### Twig Inside HTML Attributes
91
-
92
- Twix properly handles Twig embedded in HTML attribute values:
93
-
94
- ```twig
95
- <!-- Expressions in attributes -->
96
- <div class="container {{ dynamicClass }}">
97
-
98
- <!-- Conditional classes -->
99
- <div class="item {% if active %}is-active{% endif %}">
100
-
101
- <!-- Conditional attributes -->
102
- <button {% if disabled %}disabled{% endif %}>
103
- ```
104
-
105
- ### Ignore Blocks
106
-
107
- Skip formatting for specific sections using ignore directives:
108
-
109
- ```twig
110
- {# twix:ignore-start #}
111
- <div class="preserve" data-value="exactly as-is" >
112
- This content will not be formatted
113
- </div>
114
- {# twix:ignore-end #}
115
- ```
116
-
117
- ### Blank Line Handling
118
-
119
- - Multiple consecutive blank lines are collapsed to a single blank line
120
- - Blank lines immediately after opening block tags (`{% if %}`, `{% for %}`, etc.) are removed
121
- - Intentional blank lines between statements are preserved
122
-
123
- ## Limitations & Known Issues
124
-
125
- ### Not Supported
126
-
127
- - **Twig expressions are not parsed** - Content inside `{{ }}` and `{% %}` is preserved as-is, not reformatted
128
- - **No HTML entity handling** - Entities like `&nbsp;` are passed through unchanged
129
- - **No CSS/JS formatting** - Content inside `<style>` and `<script>` tags is not formatted
130
- - **Windows line endings** - Output uses Unix line endings (`\n`)
131
-
132
- ## Editor Integration
133
-
134
- ### Pre-commit Hook
135
-
136
- Using [husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/okonet/lint-staged):
137
-
138
- ```json
139
- // package.json
140
- {
141
- "lint-staged": {
142
- "*.twig": "twix"
143
- }
144
- }
145
- ```
146
-
147
- ## Development
148
-
149
- ```bash
150
- # Build
151
- go build
152
-
153
- # Run tests
154
- go test ./...
155
-
156
- # Build for all platforms
157
- ./scripts/build.sh 0.1.0
158
- ```
159
-
160
- ## License
161
-
162
- MIT