tailwind-hyperclay 0.1.14 → 0.1.15

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 (2) hide show
  1. package/index.js +3 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -153,20 +153,17 @@ function getTailwindCssName(html) {
153
153
  return null;
154
154
  }
155
155
 
156
- function hasTailwindLink(html, appName) {
157
- return extractHrefs(html).some(url => getTailwindName(url) === appName);
158
- }
159
-
160
156
  function hasAnyTailwindLink(html) {
161
157
  return extractHrefs(html).some(url => getTailwindName(url) !== null);
162
158
  }
163
159
 
164
- function replaceTailwindLink(html, newName) {
160
+ function replaceTailwindLink(html, newName, sitePath) {
161
+ const scopedName = sitePath ? `${sitePath}/${newName}` : newName;
165
162
  return html.replace(
166
163
  /(href\s*=\s*["'])([^"']+)(["'])/gi,
167
164
  (match, prefix, url, suffix) => {
168
165
  if (getTailwindName(url) !== null) {
169
- return `${prefix}https://hyperclay.com/tailwindcss/${newName}.css${suffix}`;
166
+ return `${prefix}/tailwindcss/${scopedName}.css${suffix}`;
170
167
  }
171
168
  return match;
172
169
  }
@@ -178,7 +175,6 @@ module.exports = {
178
175
  compileTailwind,
179
176
  extractCandidates,
180
177
  getTailwindCssName,
181
- hasTailwindLink,
182
178
  hasAnyTailwindLink,
183
179
  replaceTailwindLink
184
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-hyperclay",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "On-save Tailwind CSS generator for Hyperclay",
5
5
  "main": "index.js",
6
6
  "scripts": {