![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
grass-loader
Advanced tools
属性 | Description | Type | Default |
---|---|---|---|
lib | 需要用到的 grass 库 | string | @rustle/grass |
needGrass | 是否自动 import grass | boolean | false |
用两种方法导出 template,通过注释的方式,会把需要的目标方法或字符串替换到特定的注释地方
// #temp method
/* #temp method */
可以简写为:
// #temp
/* #temp */
// #temp string
/* #temp string */
demo:
<template>
<div></div>
<template/>
<script>
export default function C () {
return // #temp string
}
</script>
对于不想要参与编译的文件,可以通过 // #no compile
来阻止编译,但这行阻止编译的注释只能放在文件的最前面
demo:
// #no compile
...
template
和 script
标签都齐全的文件格式,这个时候 template
注释才有作用template
标签,那么这个标签会默认当成一个无状态组件,这个时候有两个属性供你使用,name
和 styleSrc
<!-- name 为组件的名称 -->
<!-- styleSrc 为需要的 css 文件,需要开启 cssmodules, 这样就可以配合 grass 使用 styleName -->
<template name='cm' styleSrc='./style.css'>
<div styleName='xx'></div>
</template>
script
标签,那么会作为纯 js
文件来处理,但,needGrass
配置同样生效js
文件, template
和 script
标签都不存在的情况下,会跳过编译,needGrass
配置将不会生效demo:
{
test: /\.grs$/,
use: [
{
loader: 'grass-loader',
options: {
needGrass: true,
},
},
],
exclude: /node_modules/,
}
多以可以在 grs
文件中获得 template
字符串,当然可以可以进行更改
<template>
<div></div>
</template>
<script>
const temp = (/* #temp string */)
changeTemplate(temp)
function changeTemplate (t) {
console.log(t)
...
}
</script>
FAQs
Used to precompile garss templates
The npm package grass-loader receives a total of 1 weekly downloads. As such, grass-loader popularity was classified as not popular.
We found that grass-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.