带有材料设计的材料网络2 ,我可以使用<<,我可以使用<<代码> MWC-button ,通过将模块从NPM软件包将模块从UNPKG或转移(或捆绑)导入到JavaScript文件(例如MWC-Bundle-button.js)。
<script defer
type="module"
src='https://unpkg.com/@@material/mwc-button?module'>
</script>
or
<script defer
type="module"
src='../(path)/web-components/mwc-bundle-button.js'>
</script>
<mwc-button label="button label"></mwc-button>
我想尝试一些材料的Web组件,但我不知道如何将存储库到JavaScript文件。
我尝试过,
- git克隆 lit启动器套件 )
- 在[LIT启动器套件]
构建
(也许 tsc
)中,下载材料-WEB存储库,
- 以转移到JavaScript文件
lollup -c 对于捆绑包至一个JavaScript文件
, ts2307:找不到模块'./lib/icon-styles.css'或其相应的类型声明。
发生。
这是正确的方向吗? (我可以通过解决一些错误来实现目标吗?)
或者,我有误会吗?
Material Web with Material Design 2, I could use web components like mwc-button
, by importing module from unpkg or transpiling (or bundling) to a JavaScript file (ex. mwc-bundle-button.js) from the NPM package.
<script defer
type="module"
src='https://unpkg.com/@@material/mwc-button?module'>
</script>
or
<script defer
type="module"
src='../(path)/web-components/mwc-bundle-button.js'>
</script>
<mwc-button label="button label"></mwc-button>
Material Web with Material You (Material Design 3), there are still no NPM package (@material/web) at 2022/06/29.
I want to try some web components with Material You, but I do not know how to transpile the repository to JavaScript files.
I tried,
- git clone Lit starter kit (maybe use Lit in material-web)
- download the material-web repository in the [Lit starter kit]
build
(maybe tsc
) about icon.ts for transpiling to JavaScript files
rollup -c
for bundle to one JavaScript file
Then, TS2307: Cannot find module './lib/icon-styles.css' or its corresponding type declarations.
is occurred.
Is this the right direction? (Can I reach the goal by solving some errors?)
Or, Do I have a misunderstanding?
发布评论
评论(1)
在2022/8/31,
有npm软件包@材料/web/web 。
然后,我可以使用bundling之类的Web组件(用)到NPM软件包中的JavaScript文件(ex。Bundle-md-outlined button.js)。
in 2022/8/31,
there is the NPM package @material/web.
Then, I can use web components like <md-outlined-button>, by bundling (with rollup.js) to a JavaScript file (ex. bundle-md-outlined-button.js) from the NPM package.