Skip to content

Commit

Permalink
chore: build for production
Browse files Browse the repository at this point in the history
  • Loading branch information
cossssmin committed Jul 13, 2024
1 parent 2adee99 commit 04f8c20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dist/index.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const path = require('pathe');
const postcss = require('postcss');
const isUrl = require('is-url-superb');
const defu = require('defu');
Expand All @@ -9,6 +10,7 @@ const srcset = require('srcset');

function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }

const path__default = /*#__PURE__*/_interopDefaultCompat(path);
const postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
const isUrl__default = /*#__PURE__*/_interopDefaultCompat(isUrl);
const safe__default = /*#__PURE__*/_interopDefaultCompat(safe);
Expand Down Expand Up @@ -156,7 +158,7 @@ const plugin = (options = {}) => (tree) => {
if (isUrl__default(node.attrs[attribute])) {
return node;
}
node.attrs[attribute] = typeof value === "boolean" ? options.url + node.attrs[attribute] : value + node.attrs[attribute];
node.attrs[attribute] = typeof value === "boolean" ? isUrl__default(options.url) ? options.url + node.attrs[attribute] : path__default.join(options.url, node.attrs[attribute]) : isUrl__default(value) ? value + node.attrs[attribute] : path__default.join(value, node.attrs[attribute]);
};
const prependUrl = (value, url) => {
const { css } = postcss__default([postcssBaseurl({ base: url })]).process(`div { ${value} }`, { parser: safe__default });
Expand Down
3 changes: 2 additions & 1 deletion dist/index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'pathe';
import postcss from 'postcss';
import isUrl from 'is-url-superb';
import { defu } from 'defu';
Expand Down Expand Up @@ -148,7 +149,7 @@ const plugin = (options = {}) => (tree) => {
if (isUrl(node.attrs[attribute])) {
return node;
}
node.attrs[attribute] = typeof value === "boolean" ? options.url + node.attrs[attribute] : value + node.attrs[attribute];
node.attrs[attribute] = typeof value === "boolean" ? isUrl(options.url) ? options.url + node.attrs[attribute] : path.join(options.url, node.attrs[attribute]) : isUrl(value) ? value + node.attrs[attribute] : path.join(value, node.attrs[attribute]);
};
const prependUrl = (value, url) => {
const { css } = postcss([postcssBaseurl({ base: url })]).process(`div { ${value} }`, { parser: safe });
Expand Down

0 comments on commit 04f8c20

Please sign in to comment.