Polymer_html/css_WEB-ITnose に関する予備調査
最近、いくつかのモジュラー ソリューションを探しました。Posthtml はまだあまり成熟しておらず、CSS モジュールを React と一緒に使用する必要があるため、ポリマーを試してみました。
ポリマーは Web コンポーネント仕様に基づいており、hello-world-polymer を使用するとポリマーにすぐに慣れることができます。
ポリマーモジュールの html、css、js はすべて一緒に書かれています。 hello-word.html コードは次のとおりです
<!-- Imports polymer --><link rel="import" href="../../polymer/polymer.html"><!-- Defines element markup --><dom-module id="hello-world"> <template> <p>Hello <strong>{{who}}</strong> :)</p> </template></dom-module><!-- Registers custom element --><script>Polymer({ is: 'hello-world', properties: { who: { type: String, value: 'World' } }});</script>
モジュールを定義した後、index.html ファイルにモジュールを導入し、< を使用します。 ;hello-world> タグ はい、このタグ名はモジュール内の ID と一致します。
<!doctype html><html><head> <meta charset="utf-8"> <title><hello-world></title> <!-- Imports polyfill --> <script src="../webcomponentsjs/webcomponents-lite.min.js"></script> <!-- Imports custom element --> <link rel="import" href="build/hello-world.html"></head><body> <!-- Runs custom element --> <hello-world who="world"></hello-world></body></html>
複数のモジュールは問題ありません。新しい hello-module.html を作成し、少しスタイルを付けます
<!-- Imports polymer --><link rel="import" href="../../polymer/polymer.html"><!-- Defines element markup --><dom-module id="hello-module"> <style> p{ color: red; display: flex; } strong{ color: black; } </style> <template> <p>Hello <strong>{{who}}</strong> :)</p> </template></dom-module><!-- Registers custom element --><script>Polymer({ is: 'hello-module', properties: { who: { type: String, value: 'Module' } }});</script>
を、index.html に導入します。Polymer はすでに次のように名前を追加しています。スペースとスタイルは互いに影響しません。
しかし、一部の css3 属性についてはどうでしょうか。autoprefixer または cssnext も必要です。 3 つのプラグインのサポートが必要です。コマンド ラインで
<!doctype html><html><head> <meta charset="utf-8"> <title><hello-world></title> <!-- Imports polyfill --> <script src="../webcomponentsjs/webcomponents-lite.min.js"></script> <!-- Imports custom element --> <link rel="import" href="build/hello-module.html"> <link rel="import" href="build/hello-world.html"></head><body> <!-- Runs custom element --> <hello-module who="module"></hello-module> <hello-world who="world"></hello-world></body></html>
と入力し、gulpfile.js ファイルを変更します
npm i --save gulp-posthtml posthtml-postcss postcss-cssnext
コマンド ラインで gulp を入力すると、リアルタイムでコンパイルされます。生成されたモジュールコードは以下の通りです
var gulp = require('gulp'), postcssPlugins = [require('postcss-cssnext')({ browsers: ['last 10 versions'] })]gulp.task('html', function() { var posthtml = require('gulp-posthtml'); return gulp.src('modules/*.html') .pipe(posthtml([ require('posthtml-postcss')(postcssPlugins) ]/*, options */)) .pipe(gulp.dest('build/'));});gulp.task('watch', function() { gulp.watch("modules/**.html",["html"]);});gulp.task('default', ['html', 'watch']);
テスト後、ポリマーは Android 4.1 をサポートします。テストで問題がなければ、問題なく使用できます。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









HTMLは、簡単に学習しやすく、結果をすばやく見ることができるため、初心者に適しています。 1)HTMLの学習曲線はスムーズで簡単に開始できます。 2)基本タグをマスターして、Webページの作成を開始します。 3)柔軟性が高く、CSSおよびJavaScriptと組み合わせて使用できます。 4)豊富な学習リソースと最新のツールは、学習プロセスをサポートしています。

HTMLはWeb構造を定義し、CSSはスタイルとレイアウトを担当し、JavaScriptは動的な相互作用を提供します。 3人はWeb開発で職務を遂行し、共同でカラフルなWebサイトを構築します。

Anexampleapalofastartingtaginhtmlis、それはaperginsaparagraph.startingtagsaresentionentientiontheyinitiateelements、definetheirtypes、およびarecrucialforurturingwebpagesandcontingthomedomを構築します。

webdevelopmentReliesOnhtml、css、andjavascript:1)htmlStructuresContent、2)cssStylesit、および3)Javascriptaddsinteractivity、形成、

Y軸位置Webアノテーション機能の適応アルゴリズムこの記事では、単語文書と同様の注釈関数、特に注釈間の間隔を扱う方法を実装する方法を探ります...

GiteEpages静的Webサイトの展開が失敗しました:404エラーのトラブルシューティングと解像度Giteeを使用する

画像をクリックした後、散乱と周囲の画像を拡大する効果を実現するには、多くのWebデザインがインタラクティブな効果を実現する必要があります。特定の画像をクリックして周囲を作成してください...

HTML、CSS、およびJavaScriptは、Web開発の3つの柱です。 1。HTMLは、Webページ構造を定義し、などなどのタグを使用します。2。CSSは、色、フォントサイズなどのセレクターと属性を使用してWebページスタイルを制御します。
