-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
polymer初探 #13
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
最近找了几个模块化的方案,posthtml还不是很成熟,css module需要和react一起比较好用,于是尝试了下polymer。
polymer是基于web component规范的,hello-world-polymer可以让我们快速的熟悉polymer。
polymer模块html,css,js都是写一起的,
hello-word.html
代码如下定义好模块后,只要在
index.html
文件引入模块,然后用<hello-world>
标签就可以了,这个标签名跟模块里的id是一致的。多模块也是没问题的,我们新建一个
hello-module.html
,并且给她一点样式然后在
index.html
引入浏览器显示是这样的,polymer已经帮我们加好命名空间,样式是不会相互影响的。
但是一些css3属性怎么办呢,我们还需要autoprefixer或者cssnext。需要三个插件支持,在命令行输入
然后修改
gulpfile.js
文件在命令行输入
gulp
就会实时帮我们编译了。生成的模块代码如下这样浏览器就支持了,测试了一下,polymer支持安卓4.1,如果测试没什么问题,就可以愉快的用上了。
The text was updated successfully, but these errors were encountered: