Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F147
postcss-assets.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
544 B
Referenced Files
None
Subscribers
None
postcss-assets.ts
View Options
import
type
{
Plugin
,
PluginCreator
}
from
"postcss"
;
import
{
asset
}
from
"#/assets.ts"
;
const
assetsPlugin
:
PluginCreator
<
void
>
=
function
()
:
Plugin
{
return
{
postcssPlugin
:
"assetsPlugin"
,
async
Declaration
(
decl
,
_helper
)
{
const
res
=
decl
.
value
.
match
(
/url\("([^"]+)"\)/
);
if
(
!
res
||
!
res
[
1
].
startsWith
(
"#"
))
{
return
;
}
const
assetPath
=
await
asset
(
res
[
1
]);
decl
.
value
=
decl
.
value
.
replace
(
res
[
1
],
assetPath
);
},
};
};
assetsPlugin
.
postcss
=
true
;
export
default
assetsPlugin
;
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Mon, Oct 26, 02:56 (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
109
Default Alt Text
postcss-assets.ts (544 B)
Attached To
Mode
rB blog
Attached
Detach File
Event Timeline