{"id":8234,"date":"2017-10-15T00:47:58","date_gmt":"2017-10-14T15:47:58","guid":{"rendered":"http:\/\/www.webcyou.com\/?p=8234"},"modified":"2020-03-20T18:05:11","modified_gmt":"2020-03-20T09:05:11","slug":"angular-%e3%80%8c%e3%82%b9%e3%83%9e%e3%83%9b%e3%83%bbpc%e3%80%8d%e3%81%a7component%e3%81%a8css%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b%ef%bc%88%e5%88%86%e5%b2%90%e3%81%95%e3%81%9b","status":"publish","type":"post","link":"https:\/\/www.webcyou.com\/?p=8234","title":{"rendered":"Angular \u300c\u30b9\u30de\u30db\u30fbPC\u300d\u3067component\u3068CSS\u3092\u5207\u308a\u66ff\u3048\u308b\uff08\u5206\u5c90\u3055\u305b\u308b\uff09\u65b9\u6cd5"},"content":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001Angular\u3084VueJS\u3092\u4f7f\u3063\u3066\u3001web\u30b5\u30a4\u30c8\u3084web\u30b5\u30fc\u30d3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3068\u300cPC\u30fb\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u300d\u306e\u8868\u793a\u3082\u4f5c\u3063\u3066\u884c\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u3066\u3001\u300c\u30ec\u30b9\u30dd\u30f3\u30b9\u30b7\u30d6\u300d\u306b\u7d44\u3093\u3067\u884c\u304f\u306e\u3082\u3061\u3087\u3063\u3068\u7121\u7406\u304c\u3042\u308b\u3002<\/p>\n<p>\u3063\u3066\u6642\u306f\u300c<strong>component<\/strong>\u300d\u3068\u300c<strong>CSS<\/strong>\u300d\u3092\u5207\u308a\u66ff\u3048\u305f\u304f\u306a\u3063\u3066\u304f\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u305d\u306e\u300c<strong>component<\/strong>\u300d\u3068\u300c<strong>CSS<\/strong>\u300d\u3092\u305d\u308c\u305e\u308c\u3001\u300c<strong>PC\u7528\u3068\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u7528<\/strong>\u300d\u306b\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u5074\u3067\u5206\u5c90\u3057\u3066\u304f\u308c\u308b\u3088\u3046\u306b\u4f5c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u65b9\u6cd5\u306b\u95a2\u3057\u3066\u3082\u30b0\u30b0\u3063\u3066\u307f\u3066\u3082\u4f59\u308a\u51fa\u3066\u3053\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u305b\u3063\u304b\u304f\u306a\u306e\u3067\u66f8\u3044\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u3092\u56f3\u3067\u8868\u3059\u3068\u3001\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-8245\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/ang-pc.png\" alt=\"\" width=\"550\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/ang-pc.png 772w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/ang-pc-300x196.png 300w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/ang-pc-768x501.png 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/><\/p>\n<p>Angular\u306ecomponent\u306b\u3001css\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u8aad\u307f\u8fbc\u3093\u3060Style\u306f\u3001component\u5358\u4f4d\u3067\u9069\u5fdc\u7bc4\u56f2\u3092\u7d5e\u3089\u308c\u307e\u3059\u304c\u3001\u300cPC\u3001SP\u300d\u305d\u308c\u305e\u308c\u5168\u4f53\u306b\u9069\u5fdc\u3059\u308b\u3088\u3046\u306b\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306f\u300c<strong>Angular<\/strong>\u300d\uff08v.4.2.4\uff09\u3092\u5229\u7528\u3057\u3066\u3084\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\uff08VueJS\u306f\u6b21\u56de\u306b\u3067\u3082\uff09<\/p>\n<p>\u3059\u3050\u306b\u8a66\u3057\u305f\u3044\u65b9\u306f\u3001GitHub\u306e\u65b9\u306b\u3082\u4e00\u5f0f\u4e0a\u3052\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u53c2\u7167\u3057\u3066\u9802\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/webcyou\/ang-sp-pc-template\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/webcyou\/ang-sp-pc-template<\/a><\/p>\n<h4>ng CLI\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u4f5c\u6210<\/h4>\n<p>\u3067\u306f\u3001\u65e9\u901f\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>ngCLI\u3092\u4f7f\u3063\u3066Angular\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u307e\u3060\u306e\u65b9\u306f<a href=\"https:\/\/www.webcyou.com\/?p=7786\">\u3053\u3061\u3089<\/a>\u306e\u8a18\u4e8b\u7b49\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ ng new ang-sp-pc-template<\/pre>\n<p>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u79fb\u52d5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ cd ang-sp-pc-template<\/pre>\n<p>\u300cnpm run start\u300d\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u7acb\u3061\u4e0a\u304c\u308b\u306e\u3092\u78ba\u8a8d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ npm run start<\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u300chttp:\/\/localhost:4200\/\u300d\u3067\u78ba\u8a8d\u3067\u304d\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<h4>APB CLI\u3067\u3001SCSS\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4f5c\u6210<\/h4>\n<p>\u6b21\u306bSCSS\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u3063\u3066\u884c\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>Angular\u306ecomponent\u306b\u3001css\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u8aad\u307f\u8fbc\u3093\u3060Style\u306f\u3001component\u5358\u4f4d\u3067\u9069\u5fdc\u7bc4\u56f2\u3092\u7d5e\u3089\u308c\u307e\u3059\u304c\u3001\u300cPC\u3001SP\u300d\u305d\u308c\u305e\u308c\u5168\u4f53\u306b\u9069\u5fdc\u3059\u308b\u3088\u3046\u306b\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u306e\u6d41\u308c\u3067\u300c<strong>\u30a2\u30c8\u30df\u30c3\u30af\u30c7\u30b6\u30a4\u30f3<\/strong>\u300d\u306e\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u3092\u53d6\u308a\u5165\u308c\u305f\u300c<strong>CSS\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3<\/strong>\u300d<strong>APBCSS<\/strong>\u306e\u69cb\u6210\u3067\u4f5c\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u306e\u3067\u3001\u300c<strong>APB CLI<\/strong>\u300d\u3092\u7528\u3044\u3066\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u751f\u6210\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c<strong>APB CLI<\/strong>\u300d\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u307e\u3060\u306e\u65b9\u306f\u3001<a href=\"https:\/\/www.webcyou.com\/?p=7915\">\u3053\u3061\u3089<\/a>\u306e\u8a18\u4e8b\u7b49\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ mkdir src\/assets\/scss<\/pre>\n<p>\u300c<strong>APB CLI<\/strong>\u300d\u306eapb new\u3067\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u751f\u6210\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ apb new sp<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ apb new pc<\/pre>\n<p>\u3053\u308c\u3060\u3051\u3067\u3001\u3053\u306e\u69d8\u306bSCSS\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u51fa\u6765\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8238\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/0a4c336239b5035fcf516e9920178c92.png\" alt=\"\" width=\"270\" height=\"292\" \/><\/p>\n<h4>node-sass\u3068concurrently\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>package.json\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u623b\u308a\u3001SCSS\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u306e\u70ba\u300c<strong>node-sass<\/strong>\u300d\u30d1\u30c3\u30b1\u30fc\u30b8\u3068\u3001npm run script\u3092\u540c\u6642\u306b\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u300c<strong>concurrently<\/strong>\u300d\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ npm install node-sass --save-dev<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ npm install concurrently --save-dev<\/pre>\n<p>package.json\u306erun script\u306e\u8ffd\u52a0\u3068\u4fee\u6b63\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>&#8220;scripts&#8221;: { \u5185\u306b\u4ee5\u4e0b\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><strong>package.json<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\"sass-pc\":\"node-sass --include-path scss src\/assets\/scss\/pc\/style.scss src\/style.pc.css -w\",\r\n\"sass-sp\":\"node-sass --include-path scss src\/assets\/scss\/sp\/style.scss src\/style.sp.css -w\u201d<\/pre>\n<p>&#8220;scripts&#8221;: { \u5185\u306e\u300cstart\u300d\u3092\u4fee\u6b63\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\"start\":\"concurrent\\\"ng serve\\\" \\\"npm run sass-pc\\\" \\\"npm run sass-sp\\\u201d\u201d,<\/pre>\n<p>\u305d\u308c\u3067\u306f\u3001\u30b3\u30f3\u30d1\u30a4\u30eb\u3068ng\u30b5\u30fc\u30d0\u30fc\u304c\u8d77\u52d5\u3059\u308b\u304b\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ npm run start<\/pre>\n<p>scss\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u304c\u8d70\u308a\u3001css\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u308b\u3068ng \u30b5\u30fc\u30d0\u30fc\u304c\u7acb\u3061\u4e0a\u304c\u308a\u3001\u30d6\u30e9\u30a6\u30b6\u3067\u300chttp:\/\/localhost:4200\/\u300d\u3067\u78ba\u8a8d\u3067\u304d\u308c\u3070\u6210\u529f\u3067\u3059\u3002<\/p>\n<h4>PC SP\u306ecomponent\u3092\u4f5c\u6210<\/h4>\n<p>\u7d9a\u3044\u3066\u3001\u300ccomponent\u300d\u306e\u4f5c\u6210\u3092\u884c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>component\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u300cpc\u300d\u300csp\u300d\u305d\u308c\u305e\u308c\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ mkdir src\/app\/component\/pc\/\r\n$ mkdir src\/app\/component\/sp\/<\/pre>\n<p>pc\u3001sp\u305d\u308c\u305e\u308c\u300c<strong>app.xx.component.html<\/strong>\u300d\u300c<strong>app.xx.component.html<\/strong>\u300d\u300c<strong>app.xx.module.ts<\/strong>\u300d\u300c<strong>index.ts<\/strong>\u300d\u3092\u7528\u610f\u3002<\/p>\n<p>\u30da\u30fc\u30b8\u3092\u60f3\u5b9a\u3057\u305f\u300ctop\u300d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068component\u3082\u7528\u610f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8239\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/150c9330a6f000a9997d57776af20290.png\" alt=\"\" width=\"274\" height=\"327\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/150c9330a6f000a9997d57776af20290.png 274w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/150c9330a6f000a9997d57776af20290-251x300.png 251w\" sizes=\"auto, (max-width: 274px) 100vw, 274px\" \/><\/p>\n<p>\u6e96\u5099\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3089\u3001\u305d\u308c\u305e\u308c\u8a18\u8ff0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001\u300c<strong>app.pc.component.ts<\/strong>\u300d\u3002<\/p>\n<p>\u3053\u3061\u3089\u306f\u3001pc\u5074\u306ecomponent\u306e\u30eb\u30fc\u30c8\u3068\u306a\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>css\u30d5\u30a1\u30a4\u30eb\u3092PC\u3001SP\u305d\u308c\u305e\u308c\u306b\u9069\u3057\u305f\u30d1\u30b9\u306e\u8a18\u8ff0\u3059\u308b\u4ee5\u5916\u306f\u3001\u4ee5\u4e0b\u306e\u69d8\u306b\u7279\u306b\u5909\u308f\u3063\u305f\u8a18\u8ff0\u306f\u884c\u3044\u307e\u305b\u3093\u3002<\/p>\n<p><strong>app.pc.component.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Component } from '@angular\/core';\r\n\r\n@Component({\r\n  selector: 'app-pc-root',\r\n  templateUrl: '.\/app.pc.component.html',\r\n  styleUrls: &#x5B;'..\/..\/..\/style.pc.css']\r\n})\r\nexport class AppPcComponent {\r\n}<\/pre>\n<p>\u6b21\u306b\u300ctop.component.ts\u300d\u3092\u4f5c\u6210\u3002<\/p>\n<p>\u3053\u3061\u3089\u306f\u3001\u30da\u30fc\u30b8\u7b49\u3001\u5b9f\u969b\u306b\u5229\u7528\u3059\u308bcomponent\u3092\u60f3\u5b9a\u306b\u4f5c\u6210\u3057\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n<p>app-top \u30bb\u30ec\u30af\u30bf\u3067\u547c\u3073\u51fa\u305b\u308b\u3088\u3046\u306b\u8a18\u8ff0\u3002<\/p>\n<p><strong>top.component.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Component } from '@angular\/core';\r\n\r\n@Component({\r\n  selector: 'app-top',\r\n  templateUrl: '.\/top.component.html'\r\n})\r\nexport class TopComponent {\r\n}<\/pre>\n<p><strong>app.pc.component.html<\/strong>\u306b\u306f\u3001\u5148\u7a0b\u4f5c\u6210\u3057\u305f\u300c<strong>top.component.ts<\/strong>\u300d \u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n<p><strong>app.pc.component.html<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;app-top&gt;&lt;\/app-top&gt;<\/pre>\n<p>\u3053\u308c\u3089\u306ecomponent\u3092\u307e\u3068\u3081\u308b\u300c<strong>app.pc.module.ts<\/strong>\u300d\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>declarations\u3068exports\u306b\u3001\u305d\u308c\u305e\u308c\u306ecomponent\u3092\u8a18\u8ff0\u3002<\/p>\n<p><strong>app.pc.module.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { NgModule } from '@angular\/core';\r\n\r\nimport {\r\n  AppPcComponent,\r\n  TopComponent\r\n} from '.\/index';\r\n\r\n@NgModule({\r\n  declarations: &#x5B;\r\n    AppPcComponent,\r\n    TopComponent\r\n  ],\r\n  exports: &#x5B;\r\n    AppPcComponent,\r\n    TopComponent\r\n  ],\r\n})\r\nexport class AppPCModule { }<\/pre>\n<p><strong>index.ts<\/strong>\u306f\u4e3b\u306b\u3001component\u3092\u307e\u3068\u3081\u308b\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u304c\u3001\u7701\u7565\u3057\u3066<strong>app.pc.module.ts<\/strong><br \/>\n\u306b\u8a18\u8ff0\u3057\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><strong>index.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">export * from '.\/app.pc.component';\r\nexport * from '.\/top\/top.component';<\/pre>\n<p>\u3053\u3053\u307e\u3067\u3067\u304d\u308c\u3070\u3001\u4e00\u901a\u308a\u5b8c\u6210\u3002<\/p>\n<p>PC\u5074\u3092\u4f5c\u6210\u3057\u305f\u306e\u3067\u3001SP\u5074\u3082\u540c\u3058\u69d8\u306b\u8a18\u8ff0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>SP\u5074\u306f\u5272\u611b\u3055\u305b\u3066\u3044\u305f\u3060\u304d\u307e\u3059\u3002<\/p>\n<h4>\u30eb\u30fc\u30c8\u306e\u8a2d\u5b9a<\/h4>\n<p>\u305d\u308c\u3067\u306f\u3001\u5207\u308a\u66ff\u3048\u3092\u884c\u3046\u30eb\u30fc\u30c8\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u30a8\u30fc\u30b8\u30a7\u30f3\u30c8\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u3001\u300cua-parser-js\u300d\u7b49\u3092\u4f7f\u7528\u3057\u3066\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001<\/p>\n<p><strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/faisalman\/ua-parser-js\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/faisalman\/ua-parser-js<\/a><\/p>\n<p>\u300cis.js\u300d\u306e\u65b9\u304c\u30b7\u30f3\u30d7\u30eb\u306b\u66f8\u3051\u305d\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u4f7f\u7528\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u300cis.js\u300d<br \/>\n<strong>GitHub<\/strong><br \/>\n<a href=\"https:\/\/github.com\/arasatasaygin\/is.js\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/arasatasaygin\/is.js<\/a><\/p>\n<p><a href=\"http:\/\/is.js.org\/#environment-checks\" target=\"_blank\" rel=\"noopener\">is.js environment-checks<\/a><\/p>\n<p>npm\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ npm install is_js --save<\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u51fa\u6765\u305f\u3089\u3001<strong>app.component.ts<\/strong>\u3092\u4fee\u6b63\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c&#8217;is_js&#8217;\u300d\u3092import\u3057\u3001\u300cis.mobile()\u300d\u3067\u3001\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304d\u305f\u306e\u306f\u3001PC\u304bSP\u3092\u5224\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app.component.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { Component } from '@angular\/core';\r\nimport is from 'is_js';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: '.\/app.component.html',\r\n  styleUrls: &#x5B;'.\/app.component.css']\r\n})\r\nexport class AppComponent {\r\n  public isMobile: boolean = is.mobile();\r\n}<\/pre>\n<p>\u30a2\u30af\u30bb\u30b9\u3057\u3066\u304d\u305f\u306e\u306f\u3001PC\u304bSP\u3067\u3001\u547c\u3073\u51fa\u3059component\u3092\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<\/p>\n<p><strong>app.component.html<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;app-pc-root *ngIf=&quot;!isMobile&quot;&gt;&lt;\/app-pc-root&gt;\r\n&lt;app-sp-root *ngIf=&quot;isMobile&quot;&gt;&lt;\/app-sp-root&gt;<\/pre>\n<p>\u300c<strong>app.module.ts<\/strong>\u300d\u306b\u306f\u3001\u305d\u308c\u305e\u308c\u306emodule\u3067\u3042\u308b\u300cAppPCModule\u300d\u3068\u3001\u300cAppSPModule\u300d\u3092\u3001imports\u3068exports\u306b\u8a18\u8ff0\u3059\u308c\u3070\u5b8c\u6210\u3002<\/p>\n<p><strong>app.module.ts<\/strong><\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">import { BrowserModule } from '@angular\/platform-browser';\r\nimport { NgModule } from '@angular\/core';\r\n\r\nimport { AppPCModule } from '.\/component\/pc\/app.pc.module';\r\nimport { AppSPModule } from '.\/component\/sp\/app.sp.module';\r\n\r\nimport { AppComponent } from '.\/app.component';\r\n\r\n@NgModule({\r\n  declarations: &#x5B;\r\n    AppComponent,\r\n  ],\r\n  imports: &#x5B;\r\n    BrowserModule,\r\n    AppPCModule,\r\n    AppSPModule\r\n  ],\r\n  exports: &#x5B;\r\n    AppPCModule,\r\n    AppSPModule\r\n  ],\r\n  providers: &#x5B;],\r\n  bootstrap: &#x5B;AppComponent]\r\n})\r\nexport class AppModule { }<\/pre>\n<p>\u3068\u3001\u3053\u3053\u307e\u3067\u3067\u4e00\u65e6\u5b8c\u6210\uff01\uff01<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067\u300chttp:\/\/localhost:4200\/\u300d\u3067\u78ba\u8a8d\u3059\u308b\u3068\u3001PC\u3067\u306e\u30a2\u30af\u30bb\u30b9\u3068\u3001SP\u3067\u306e\u30a2\u30af\u30bb\u30b9\u3067\u8868\u793a\u304c\u5207\u308a\u66ff\u308f\u3063\u3066\u3044\u308b\u306e\u304c\u78ba\u8a8d\u51fa\u6765\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8241\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/447b26e01e8e12ce8345ed945efc46c1.png\" alt=\"\" width=\"196\" height=\"53\" \/><\/p>\n<p><strong>PC<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8242\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/a35b8c0561367478c2d994345c653961.png\" alt=\"\" width=\"129\" height=\"43\" \/><\/p>\n<h4>CSS\u3092\u8abf\u6574<\/h4>\n<p>\u6700\u5f8c\u306b\u3001CSS\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<p>Angular\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30b9\u30bf\u30a4\u30eb\u3067\u306f\u3001component\u306b\u3001css\u30d5\u30a1\u30a4\u30eb\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u8aad\u307f\u8fbc\u3093\u3060Style\u306f\u3001component\u5358\u4f4d\u3067\u9069\u5fdc\u7bc4\u56f2\u3092\u7d5e\u3089\u308c\u307e\u3059\u306e\u3067\u3001Shadow DOM\u306b\u7531\u6765\u3059\u308b\u7279\u6b8a\u306a\u30bb\u30ec\u30af\u30bf\u3092\u4f7f\u7528\u3057\u3001\u9069\u5fdc\u7bc4\u56f2\u3092\u5e83\u3052\u307e\u3059\u3002<\/p>\n<p>PC,SP\u306e<strong>style.scss<\/strong>\u305d\u308c\u305e\u308c\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u300c:host \/deep\/\u300d\u3092\u8a18\u8ff0\u3057\u3066\u3001\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306b\u9069\u5fdc\u3055\u305b\u307e\u3059\u3002<\/p>\n<p><strong>style.scss<\/strong><\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">:host \/deep\/ {\r\n  @import \"common_inc\";\r\n  @import \"parts\";\r\n  @import \"pages\/pages_inc\";\r\n}<\/pre>\n<p>:host\u64ec\u4f3c\u30af\u30e9\u30b9\u30bb\u30ec\u30af\u30bf\u306f\u3001\u305d\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u81ea\u8eab\u306b\u30de\u30c3\u30c1\u3057\u307e\u3059\u3002(\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u5185\u306e\u3059\u3079\u3066\u306e\u8981\u7d20\u306b\u9069\u5fdc\u3055\u308c\u308b\u308f\u3051\u3067\u306f\u306a\u3044\u3067\u3059)<\/p>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30b9\u30bf\u30a4\u30eb\u306f\u57fa\u672c\u7684\u306b\u3001\u81ea\u8eab\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u5185\u306b\u3057\u304b\u9069\u7528\u3055\u308c\u306a\u3044\u306e\u3067\u3059\u304c\u3001\/deep\/\u30bb\u30ec\u30af\u30bf\u3092\u4f7f\u3046\u3068\u3001\u5f37\u5236\u7684\u306b\u5b50\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u5185\u90e8\u306b\u30b9\u30bf\u30a4\u30eb\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\/deep\/\u30bb\u30ec\u30af\u30bf\u306f\u300c&gt;&gt;&gt;\u300d \u306b\u7f6e\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001SCSS\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u3060\u3068\u3001\u300c&gt; &gt; &gt;\u300d\u3068\u30b9\u30da\u30fc\u30b9\u304c\u5165\u3063\u3066\u3057\u307e\u3044\u9069\u5fdc\u3055\u308c\u306a\u304b\u3063\u305f\u306e\u3067\u300c\/deep\/\u30bb\u30ec\u30af\u30bf\u300d\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u4ed6\u306b\u3082\u300c:host-context\u30bb\u30ec\u30af\u30bf\u300d\u306a\u3069\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u8aac\u660e\u306f\u5272\u611b\u3055\u305b\u3066\u9802\u304d\u307e\u3059\u3002<\/p>\n<p>PC\u3060\u3051font-size\u3092\u5909\u66f4\u3057\u3066\u307f\u307e\u3057\u305f\u3089\u3001PC\u306e\u307f\u9069\u5fdc\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8243\" src=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/f6ba3f384f64f0a8aa2fa22c65821f77.png\" alt=\"\" width=\"317\" height=\"74\" srcset=\"https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/f6ba3f384f64f0a8aa2fa22c65821f77.png 317w, https:\/\/www.webcyou.com\/wp-content\/uploads\/2017\/10\/f6ba3f384f64f0a8aa2fa22c65821f77-300x70.png 300w\" sizes=\"auto, (max-width: 317px) 100vw, 317px\" \/><\/p>\n<p>\u3068\u3001\u8a00\u3063\u305f\u308f\u3051\u3067\u7c21\u5358\u3067\u3057\u305f\u304c\u3001PC\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u30a2\u30af\u30bb\u30b9\u306b\u3088\u3063\u3066\u300ccomponent\u300d\u300cSCSS\u300d\u3092\u5207\u308a\u66ff\u3048\u308b\u65b9\u6cd5\u3067\u3057\u305f\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30bd\u30fc\u30b9\u306f\u3001GitHub\u306e\u65b9\u306b\u3082\u4e00\u5f0f\u4e0a\u3052\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u53c2\u7167\u3057\u3066\u9802\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p><strong>GitHub<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/webcyou\/ang-sp-pc-template\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/webcyou\/ang-sp-pc-template<\/a><\/p>\n<p>\u6b21\u56de\u306f\u300c<strong>VueJS<\/strong>\u300d\u3067\u306e\u65b9\u6cd5\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3059\u30fc<\/p>\n<p>\u3067\u306f\u3041\u3067\u306f\u3041\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3082\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001Angular\u3084VueJS\u3092\u4f7f\u3063\u3066\u3001web\u30b5\u30a4\u30c8\u3084web\u30b5\u30fc\u30d3\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3044\u308b\u3068\u300cPC\u30fb\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u300d\u306e\u8868\u793a\u3082\u4f5c\u3063\u3066\u884c\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u3066\u3001\u300c\u30ec\u30b9\u30dd\u30f3\u30b9\u30b7\u30d6\u300d\u306b\u7d44\u3093\u3067\u884c\u304f\u306e\u3082\u3061\u3087\u3063\u3068\u7121\u7406\u304c\u3042\u308b\u3002 \u3063\u3066 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[203],"tags":[171,59,167,177,181,168,176,166,37,47,46,169,180,150,44,45,78,114,118],"class_list":{"0":"post-8234","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-angular2","7":"tag-android","8":"tag-android-sdk","9":"tag-css","10":"tag-css3","11":"tag-facebook","12":"tag-html","13":"tag-html5","14":"tag-iphone","15":"tag-iphone-","16":"tag-javascript-2","17":"tag-js","18":"tag-mac","19":"tag-mysql","20":"tag-vagrant","21":"tag-web","23":"tag-78","24":"tag-114","25":"tag-118"},"_links":{"self":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/8234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8234"}],"version-history":[{"count":12,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/8234\/revisions"}],"predecessor-version":[{"id":10182,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=\/wp\/v2\/posts\/8234\/revisions\/10182"}],"wp:attachment":[{"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcyou.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}