èªç¤¾ã®ç¤¾å åå¼·ä¼ã«é¢ããBlogãæ¸ãã¾ãã
èªåã®Blogã§ã¯ãªããä¼ç¤¾ã®æè¡Blogãæ´æ°ããã®ã¯åãã¦ã§ããã
ãã¡ãã®è¨äºãæ¸ãã¦ããã¾ã(´・Ïï½¥)ã£
æ¥åãã¿ã§ä½ãæ¸ããã¨æã£ã¦ããã®ã§ããã
ã¡ããã©ç¤¾å
åå¼·ä¼ããããå
·ä½çãªãã¼ããè¦ãã¦ããªãã£ãã®ã§ã
ãã®ã¾ã¾ä¹ã£ãããã¦ããã ãã¾ãã
ä»ã«ããããã話ã¯åºã¦ãã¦ããã£ã¨è³æã詳細ã ã£ãã®ã§ããã
社å
ã®ãã¾ãç´°ããã¨ããã¯å¤ã«åºããªãã®ããã£ã¦ã
ãã®ãããªå½¢ã«è½ã¡çãã¦ããã¾ã
ããã¨çé¢ç®ãªè©±ãå¼ç¤¾ã¯ã¨ã³ã¸ãã¢ãå
¨ç¶è¶³ãã¦ããªãã®ã§ã
ããèå³ãããã°ããã²ã声ãããã ãã
Railsã¨ã³ã¸ãã¢ã§ãªãã¦ãåé¡ãªãã¨æãã¾ã(ï½ï½¥Ï・´) b
ãã§ã³ã¯ããã¼ãã£ã¼ã·ãã¥ã¬ã¼ã¿ã¼ ééã®ãç¥ãã
é·ããã¨æ´æ°ãç¶ãã¦ããããã§ã³ã¯ããã¼ãã£ã¼ã·ãã¥ã¬ã¼ã¿ã¼ãï¼ccptsï¼ã§ããã
2021å¹´ã®2ææ«ã§ééãããã¨ã«ãã¾ãã(´・Ïï½¥`)
ã»ã¬ã®ãã¡ã³ãµã¤ãã«ä½ãèªåã®ãµã¤ããæ²è¼ãããã¨ãããã£ããããã
èªåã®æ¬²ãããã¼ã«ã2014å¹´ãããã£ã¨æ´æ°ãã¦ãã¾ãããã
3é¨ã®çµäºã¨ã¨ãã«æ´æ°ãæ¢ã¾ã£ã¦ãããæ£å¼ã«ééãããã¨ã«ãã¾ãã
çç±ã®ä¸ã¤ã¯ãã§ã³ã¯ãèªä½ã®ã¢ããã¼ã·ã§ã³ãä¸ãã£ããã¨ã§ããã
æè¡çã«ãããã試ããã¨ã¯æã£ã¦ãããã®ã®ã
æ°ããä»äºã®é¢ä¿ã§æéãåããã大å¹
ãªå·æ°ãå
¥ããã®ãé£ãããªã£ãã®ã大ããã§ã
ä»ããä¸åº¦ä½ãã®ã§ããã°ãfront-backendæ§æã§ã
frontãç´ç²ãªNuxtã§ä½ãç´ãã¨æãã¾ããã
ããã¾ã§ããæéãæ»åºã§ãã¾ããã§ãã
RubyãRailsãªã©ã®ã¢ãããã¼ãã試ããã©ã¤ãã¼ãç°å¢ã¯æ¬²ããã®ã§ã
ã¾ãä½ãä½ãã¨ã¯æãã¾ããããã£ããccptsã«ã¤ãã¦ã¯çµäºã¨ãããã¨ã§
ã©ã®ç¨åº¦ã®æ¹ã使ã£ã¦ããã®ãã¯å
¨ãææ¡ã§ãã¦ããªãã»ã»ã»ã¨ããããã
ããã¦ãã¦ããªãã£ãã®ã§ããããå©ç¨ãããã¨ããããã¾ãã
tslintããeslintã«ç§»è¡ãã件
ãã®æ¥ãããä»äºãå¤ãã£ãé¢ä¿ã§ã
ãªããªãæè¡çãªããããããããæéããªããªã£ã¦ããã¾ãã(´-Ï-)
ccptsã®æ°ãããã¼ã¸ã§ã³è¨è¨ãèãã¦ã¯ããã®ã§ããã
ããã«çæããä½è£ããªãã¦ã§ããã»ã»ã»
ãããªä¸ã§ãccptsã®æ´æ°ã¯ç¶ãã¦ããããã§ããã»ã»ã»
ã»ã»ã»ãä»äºã§TypeScriptã触ã£ã¦ãããä¹
ã
ã«ç°å¢æ§ç¯ããã¨ããã
tslintãå®è³ªã亡ããªãã«ãªã£ã¦ãããã¨ãç¥ãã¾ãã¦Î£(ï¾Ðï¾)カï¾ï½°ï¾
æ¢ãã°è¨äºãããããåºã¦ããã®ã§ã詳細ã¯å²æãã¾ããã
2020å¹´æç¹ã§tslintã¯ãã§ã«éæ¨å¥¨ã§ã
ã¨ãããã¨ã§ãæ£ããtslintããeslintã«ç§»è¡ãããã¨ã«ããã®ã§ããã
ããã§åé¡ã«ãªã£ãã®ãprettierã¨ãããã©ã¼ããã¿ã§ã
ã ãããã»ããã§ä½¿ããã¦ãããã®ã®ã
eslintã»ã©èéãå©ãããæ¢åã®å®ç¾©ã¨ã³ã³ããªã¯ããã¾ãã£ã¦ã
ãªããªã使ãã¥ããã¦ã§ããã»ã»ã»(´-Ï-)
çµå±ãprettierã使ãããeslintã¸ã®ç§»è¡ã®ã¿ãããã¾ãã
TypeScriptå°å
¥åã«ãeslintãç´°ããã«ã¹ã¿ã ãã¦ããã
ãã®è¨å®ãã¡ã¤ã«ãæ¶ãå¿ãã¦ãããããã§ã
initã§çæãããå®ç¾©ã«æã®è¨å®ã³ãããã¦ãåé¡ãªã移è¡ã§ãã¾ãã(ï½ï½¥Ï・´) b
ã¨ãããã¨ã§ãæ©étypescript-eslintã使ã£ã¦ã³ã¼ãã調ã¹ã
ææãåãã¦ä¿®æ£ããã®ããã¡ããªã®ã§ããã»ã»ã»
ã»ã»ã»ãããä»ã¾ã§tslintã£ã¦åãã¦ããã§ãããï¼Î£(ã»Ïã»ã)ã
ææã¡ã®ã¢ããªã§ãã¡ã¤ã³é§åè¨è¨ï¼DDDï¼ã試ãã¦ã¿ãããå°å ¥ç·¨ã
ãã£ããã¯ãWEB+DB PRESSãã®è¨äºãªã®ã§ããã»ã»ã»
- ä½è : éç°å¥,å°åä¸å,西岡å¿,æ¨æå¥ç¾,澤ç°å,æç¬å 宣,æ¾å²¡å¹¸ä¸é,è¤äºè¬å£«æ,äºä¸çå²,å±±å£æ ¶å,æ± ç°æå¸,å°å±±å²å¿,æ«æ°¸ææ£,ä¹ ä¿ç°ç¥å²,é´æ¨æä»,ç§å¤§è¼,笹ç°èä¸,æ¾æ¬å®å¤ª,尾形é次,ã¯ã¾ã¡ã2,竹å,渡辺淳,岩äºè¯å¤ª,åç°å¥å¤ª,WEB+DB PRESSç·¨éé¨
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2019/10/23
- ã¡ãã£ã¢: åè¡æ¬
- ãã®ååãå«ãããã°ãè¦ã
ã»ã»ã»æè¿ããã¡ã¤ã³é§åè¨è¨ï¼DDDï¼ãã®åå¼·ããã¦ããã¾ã...Ï(ï½¥Ïï½¥ï½)
ä»ã¾ã§ãæ¼ ç¶ã¨ææ¡ãããã¤ãããã«ãªã£ã¦ããã®ã§ããã
ä»å¾ã®ãã¨ãèããã¨ããæ£ããç¥èãã身ã«ã¤ããå¿
è¦ããããªã»ã»ã»ã¨
çµå±ã®ã¨ãããåå ¸ã«ããããããªãã®ã§ããã»ã»
- ä½è : ã¨ãªãã¯ã»ã¨ã´ã¡ã³ã¹,ä»é¢å,åæºå³æ¡,ç§éç¥å
- åºç社/ã¡ã¼ã«ã¼: ç¿æ³³ç¤¾
- çºå£²æ¥: 2011/04/09
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 19人 ã¯ãªãã¯: 1,360å
- ãã®ååãå«ãããã° (131件) ãè¦ã
å®è·µãã¡ã¤ã³é§åè¨è¨ (Object Oriented SELECTION)
- ä½è : ã´ã¡ã¼ã³ã»ã´ã¡ã¼ãã³,é«æ¨æ£å¼
- åºç社/ã¡ã¼ã«ã¼: ç¿æ³³ç¤¾
- çºå£²æ¥: 2015/03/17
- ã¡ãã£ã¢: 大åæ¬
- ãã®ååãå«ãããã° (4件) ãè¦ã
ã»ã»ã»ãããã§ããããã£ã¡ãé£ãããã§ãã(´-Ï-)
DDDã¯ãæ¦å¿µãã¨ããããè¨è¨ææ³ãã§ããã
ãåå
¸ï¼ï¼ã¨ãªãã¯ã»ã¨ã´ã¡ã³ã¹ã®ãï¼ããèªã¿å§ãããã®ã®ã
ãããã¥ããã®ã§ãå®è·µããèªã¿å§ããããã¾ããåå
¸ãã«æ»ã£ã¦ãã¨ããΣ(ã»Ïã»ã)ã
éä¸ã¾ã§èªãã ã ãã§ãééããªããããã®ã¯ã
ä»ã¾ã§ãã£ã¦ãããè¨è¨ãã¯ãæ¥åãæ½è±¡åããè¨è¨ã«ãªã£ã¦ãªããã¨ãããã¨ã§ã
ãã¾ãã«ãã¢ã¼ããã¯ãã£ãããã¤ã³ãã©ããä¸ã«å
¥ãè¾¼ã¿ããã¦ããã
ãæ¥åãã¸ãã¯ãããããã®ï¼æ¬æ¥ã§ããã°å¾å±ã§ããã¯ãã®ï¼æ¦å¿µã«ã
ã ãã¶å½±é¿ãåãã¦ãã¾ã£ã¦ãã¾ã(´・Ïï½¥`)
ã¾ããå®éããã§ãåä½ãã¦ãããã
å¤ãã®ã·ã¹ãã ã¯åç´ãªCURDã¢ããªã±ã¼ã·ã§ã³ã®çµã¿åããã§ãããã®ã§ããã
ä»ãã£ã¦ãããããªå¤§ããã®ã·ã¹ãã ãåè¨è¨ããã«ã¯ããã¾ãã«ææ³ãå¼±ããã¾ã
ã»ã»ã»ã¨ããã¨ããã¾ã§ã¯ç解ãã¦ãã
æ£ç´ãã©ãããåãããã£ããã®ããã£ã±ãã ã£ãã®ã§ã
ãWEB+DB PRESSãã®è¨äºãæ¸ããæ¹ã®Blogãåèã«ãããã¨ã«
ã¨ããããããããèµ·ç¹ã«ããããè¦ã¦ããã¨ã
ãªãã¨ãªãæ¦è¦ã¯ã¤ããã¾ã(`ï½¥Ï・´)
ãã¨ã¯ãã¡ãã®å人èªã¨ã
åºæ¬çãªæ¦å¿µã«è§¦ãããã¦ããã
å®éã®ç¾å ´ãæ³å®ããä¾ãè¼ã£ã¦ãããæ¬ããªã®ã§ã
ãã¡ããããããã§ã
ï¼ãã ãããããã«ããDDDã«é¢ãã¦ã¯ãåå
¸ãã«æ»ããããªãæ°ã¯ãã¾ã
ãç¨èªã¨ãåæ©çãªæ¦å¿µã¨ããã ãããã¯ãåå
¸ãããå¼ç¨ããã
ãããããã®çºå±çãªè©±ããã¦ããã®ã§ã»ã»ã»ï¼
ããããµã¾ããä¸ã§ãä½ããããããªã®ã§ããã»ã»ã»
æ¥åã«å°å
¥ããã«ã¯æ·å±
ãé«ãæè¡ãã
ã¨ãããã試ãããã«ãç§ã¯ãããã®ãæã£ã¦ãã¾ã(`ï½¥Ï・´)
ã¨ãããã¨ã§ãã¾ãã¯ããã§ã³ã¯ããã¼ãã£ã¼ã·ãã¥ã¬ã¼ã¿ã¼ãï¼ccptsï¼ã®
è¨è¨ãè¦ç´ãã¦ã¿ããã¨ã«...Ï(ï½¥Ïï½¥ï½)
ãã¤ã³ãã¯ä»¥ä¸ã§ã
- ã¯ã©ã¤ã¢ã³ãå´ã主ä½ã«DDDãé©ç¨ãã
- ccptsã®æ¥åãã¸ãã¯ã¯ã¯ã©ã¤ã¢ã³ãå´ã§ããããµã¼ãã¯ãã¼ã¿ãæä¾ããã ããªã®ã§
- ãµã¼ãAPIã¯ãã¢ã«ã«ãæ¤ç´¢ãã®ã³ã³ããã¹ãã®ä¸ã¤ã¨ãã¦èããããããã¯ãªãã¸ããªããå¼ã°ãã
- å®è£
ã«TypeScriptã使ã
- ã¯ã©ã¤ã¢ã³ãã¯å ã TypeScriptã§æ¸ããã¦ãã
- TypeScriptãªããªãã¸ã§ã¯ãæåã®æ©è½ãã ãããæã£ã¦ãã
- è¨è¨ããèµ·ãããã³ã¼ãããã®ã¾ã¾ãµã¼ãã¹ã«é©ç¨ã§ãã
ã¨ãããã¨ã§ã軽ãå®è£ ãã¦ã¿ããã¡ã¤ã³ã¢ãã«ããã¡ãã§ã(´・Ïï½¥)ã£
ccptsã®ä¸»è¦ãªæ©è½ã¯ããã¼ãã£ã¼ãç·¨æãããã¨ãã§ããã
ãã¢ã«ã«ããæ¤ç´¢ãããã¨ãã¯ãã®æ¯æ´æ©è½ãªã®ã§ã
ããã¼ãã£ã¼ç·¨éããã³ã¢ãã¡ã¤ã³ã§ããã¢ã«ã«ãæ¤ç´¢ãããµããã¡ã¤ã³ã§ã
ã¾ãã¯ããã¼ãã£ã¼ç·¨éã³ã³ããã¹ããã«å±ãããã¡ã¤ã³ã¢ãã«ãèãã¦ã
ã³ã¼ãã«èµ·ããããã®ãgistã®å®è£
é¨åã§ã
ãã¤ã³ãã¯ããã¤ããã£ã¦ã»ã»ã»
- ãã¦ããã¿ã¹è¨èªããæèãã¦ä»æ§ãæ¸ããã®ã§ãå®è£ ã«è½ã¨ãããã
- ã¢ã«ã«ãã¯éç´ã«ã¼ãã§ã以ä¸ã«å¤§éã®å¤ãªãã¸ã§ã¯ããä¿æãã¦ããããä»æ§ã«æ¸ããã¦ãªãã®ã§ç¡è¦ãã¦ãã
- ã¢ãã«ã®é¢é£ãä»æ§ã¨ãã¦è¨è¿°ããã®ãéè¦ã§ãã¢ã«ã«ãã®æ§é ã¯ä»åã®ç¯å²ã ã¨é¢ä¿ããªã
- ãå¤ãªãã¸ã§ã¯ããã¨ãã¦å®ç¾©ããã¢ãã«ã¯ãgetterããæã£ã¦ãªã
- æ°ãã«ããã¬ã¤ã¤ã¼ãã¼ãã£ã¼ãã®æ¦å¿µãå°å
¥ãããã¨ã«ããããåãã¢ã«ã«ããä¸ã¤ããã»ããã§ããªãï¼ãã ããã¬ã³ããé¤ãï¼ãã®ä»æ§ãã·ã³ãã«ã«ã«ãã»ã«åããã
- 以åã¯ãã¬ã³ããé¤å¤ããã®ã«é¢åãªãã¸ãã¯ãæ¸ãã¦ãã
ã»ã»ã»ãã£ãããããªæãã§ãã...Ï(ï½¥Ïï½¥ï½)
å
ã®ã³ã¼ãã¯ä»ã¾ã§ã®çµç·¯ã§ç¶ã足ãã¦ãããã®ãªã®ã§ã
ããç¨åº¦æ´çããã¦ããã¨ã¯ãããã©ããã¦ãæ¥åãã¸ãã¯ãåæ£ãã¦ãã¾ã
ãããUIãåå¾æ¹æ³ãªã©ã¨ç¡é¢ä¿ã«ãã¢ãã«ã«å¶ç´ãä»æ§ãéããç¶æ
ã«ãªãã¾ãã
ã¾ããDDDã®éè¦ãªæ¦å¿µã§ãããã¦ããã¿ã¹è¨èªããæèãã¦ä»æ§ãæ¸ããã®ã§ã
ã³ã¼ãã«åæ ãããã®ãç°¡åã§ããã¹ããä½ãæ¸ãã°ããã®ãæããã«ãªãã¾ã(ï½ï½¥Ï・´) b
ããã¾ã§ããã¡ã¤ã³ã¢ãã«ãã®ç¯å²ã§é©ç¨ããã ãã§ããã
ããã ãã§ããªãã¨ãªãæ¹åæ§ã¯è¦ãã¦ããã®ã§ã
ãã®ãã¡ã¤ã³ã¢ãã«ãè²ã¦ãªãããæ¬ãèªã¿é²ãã¦ã¿ã¾ã
ReactOnRailsã¨SSRã¨Webpackerãæ¨ã¦ã¦Webpackã«ç§»è¡ãã件
ä¹ ã ã«ããã§ã³ã¯ããã¼ãã£ã¼ã·ãã¥ã¬ã¼ã¿ã¼ãï¼ä»¥ä¸ãccpsãï¼ã®ã話ã§ã
Rails6ã®RC2ããªãªã¼ã¹ãããã®ã§ãå¤ä¼ã¿ã®èª²é¡çãªæãã§ã
Rails6ã¸ã®ç§»è¡ãé²ãããã¨æã£ãã®ã§ããã»ã»ã»
ã»ã»ã»ãªããReactOnRailsã¨Webpackerãæ¨ã¦ã¦ã
ãã¥ã¢ãªWebpackã«ç§»è¡ãã¦ããã®ã§ãΣ(ã»Ïã»ã)ã
react_on_railsを破棄し、webpackに移行 · parrot-studio/cc-pt-viewer@592a34d · GitHub
æ£ç´ãçæéã«ããããããéãã¦ãç§ã®ä¸ã§ãæ´çãããã¦ããªãã®ã§ããã
å¤ä¼ã¿ã®èª²é¡ãã¬ãã¼ãã¨ãã¦ã¾ã¨ãã¦ããã®ãå¿
è¦ãªãã¨ãªã®ã§ã
è¦ãã¦ããç¯å²ã§ããããæ¸ãã¦ããã¾ã...Ï(ï½¥Ïï½¥ï½)
ä»åè¨ããããã¨
- ãµã¼ããµã¤ãã¬ã³ããªã³ã°ï¼SSRï¼ã¯ããªãéããã®ã§ãä»ã®é¨åã§æé©åã§ããªããæ¤è¨ãã¦ã¿ãæ¹ãè¯ã
- Railsã®ãWebpackerããç解ããã«ã¯ãWebpackãã®ç¥èãå¿ è¦ã§ãWebpackãããããªãWebpackerã¯ãããåé·ãªã®ã§ã¯ï¼
ä»åã®çµç·¯
é¢åãªã®ã§ããã£ã¨çµç·¯ãã¾ã¨ãã¦ããã¾ã...Ï(ï½¥Ïï½¥ï½)
- SSRã§éç¨ä¸ã«ã¢ããªã¬ãã«ç£è¦ãå
¥ããã¨ãããé »ç¹ã«è¦åãæ¥ãããã«ãªã£ã
- éã ã£ãç®æãä¿®æ£ããããæ»æãã¦ããIPãå¼¾ãã¦ãã£ãçµæãç£è¦ãã®ãã®ãéãããè¦å ã¨å¤æ
- 5åã«1åç£è¦ãã¦è½ã¡ããããªãµã¤ãã£ã¦ç¸å½ã«åé¡ã§ã¯ï¼
- ReactOnRailsã§SSRã®ãã£ãã·ã¥ã使ããã¨æã£ãããææã§ãªãã¨ä½¿ããªã
- çµæãã©ããã®ã¿ã¤ãã³ã°ã§SSRãããã¦è¨è¨å¤æ´ãããã¨æ±ºãã
- ãã®å¾ãRails6ã®RC2ããªãªã¼ã¹ããããã¨ãç¥ã
- ãã¤ãã®ããã«æ°è¦ã§Rails6ããã¸ã§ã¯ããç«ã¡ä¸ããã³ã¼ãã移æ¤ãã¦ãã
- Railsã§jsãcssãã¾ã¨ãã¦ããSprocketsããRails6ã ã¨ããã©ã«ãã§ã¯ãªããã¨ãç¥ã
- ãã®æç¹ã§ãå®å ¨ã«Webpackerã«ç§»è¡ããã¨æ±ºããããæ©ä¼ãªã®ã§ReactOnRailsãåãæ¨ã¦ã
- 試è¡é¯èª¤ã®çµæãWebpackerã®ã¿ã§developmentã®åä½ã確èªãã
- stagingã§ã®ãããã¤ã試ããã¨ããã£ã¦ãã¦ãéç¨ã®ããã®è¦ä»¶ï¼ä¾ï¼å§ç¸®çï¼ãæºãããªãã»ã»ã»ã¨ãããããWebpackerã®æ å ±ãå°ãªããã¦ç ´ç¶»ãã
- ãWebpackerãã§ã¯ãªããWebpackãã®æ å ±ãªãå±±ã»ã©ãããWebpackerãç ´æ£ããäºä¾ãã¿ã¦ãWebpackerã®ç ´æ£ã決ãã
- Webpackã®configã§ããªãè¦æ¦ããããçµæçã«ç¡é§ã«å«ã¾ãã¦ããã³ã¼ããæé¤ãããã¨ã«æå
- ãSSRãWebpackerããããªãã£ãããã»ã»ã»(´-Ï-)ã <- ï½²ï¾ï½ºï½º
åèã«ãããµã¤ã
- TypeScriptã§æ¸ãããReactãWebpackerã§åããããã®åå°
- WebpackerããWebpackã¸ã®ç§»è¡
- Webpack4ãç解ãã
- CSSãjsã§importããã®ãã¢ããã©ãã©ãã«ããªããã®ã»ã»ã»ã®è§£ç
- fontawesome5ãã¾ããã¨importãããã®ãã¢ããã©ãã©ãã«ããªããã®ã»ã»ã»ã®è§£ç
以éã¯ç§èªèº«ã®ããã®ã¡ã¢æ¸ãã§ã...Ï(ï½¥Ïï½¥ï½)
SSRã®éçã¨çµæçã«å¾ãããã¡ãªãã
ccptsã¯jQueryã¨Reactã§æ§ç¯ããã¦ããããã
SSRã¯é£ãããã«æãã¾ãããããã©ã¦ã¶ãå¿
è¦ã¨ããã³ã¼ããã¨ã
ãéçãªHTMLãçæããããã®ã³ã¼ãããåé¢ãããã¨ã§ãSSRã«æåãã¾ãã(`ï½¥Ï・´)
- React+jQuery+RailsのSPAをサーバサイドレンダリングに移行した件(その1:概要編) - ぱろっと・すたじお
- React+jQuery+RailsのSPAをサーバサイドレンダリングに移行した件(その2:ブラウザ依存排除編) - ぱろっと・すたじお
- React+jQuery+RailsのSPAをサーバサイドレンダリングに移行した件(その3:設計変更編) - ぱろっと・すたじお
ããèªä½ã¯æºè¶³ãã¦ããã®ã§ãããåé¡ã¯ãã¯ããµã¼ãã®è² è·ã§ã
ããææãããããVPSã®æ©è½ã§ç£è¦ãã»ããããã¨ããã
ç£è¦ã¢ã¯ã»ã¹ã®è² è·ã§è¦åãæ¥ãããã«Î£(ï¾Ðï¾)カï¾ï½°ï¾
5åã«1åç¨åº¦ãTOPã«ã¢ã¯ã»ã¹ãããç¨åº¦ã§éããªã*1ããã§ã¯ã
Webãµã¤ãã¨ãã¦æ©è½ãã¦ãªãã§ããã
ãã®ããã«VPSããã¼ã¸ã§ã³ã¢ããããã®ãä½ãéãã¾ã
ãããããSSRåã®è¨äºã§ãæ¸ããããã«ãSSRã¯æå¾ã®æ段ã§ããã
å¯è½ã§ããã°æåããé©åãªãã¡ã¼ã¹ããã¥ã¼ãçµããæ¹ãããã®ã§ã
ReactOnRailsã®åãé¢ã
ããããReactOnRailsã¯ä½ããã¦ããã®ã§ããããï¼
- jsã®ä¾åé¢ä¿è§£æ±ºã¨çµ±å
- ã¾ã¨ããjsãRailsã®assetsã¨ãã¦æ±ããããã«ãã
- Rubyã®æèã§æ¸¡ãããã¼ã¿ããReactã®åæpropsã¨ãã¦æ¸¡ã
- ã¾ã¨ããjsãããµã¼ããµã¤ãã§HTMLãçæããï¼ãªãã·ã§ã³ï¼
ä»ã«ãããããã¤æã®ãassets:precompileãã«ããã¯ããããã¨ãã
ç´°ãããã¨ããã£ã¦ãã¾ããã大æ ã§ã¯ãããªæãã§ã
ããããRailsãWebpackerãæ¡ç¨ãã¦ä»¥éã
Railså´ã¨å調ãã¦ãããããªæ©è½ãæ´çããã¦ãã£ãçµæã
ãWebpackerï¼Î±ããããã®ç«ã¡ä½ç½®ã«ãªã£ã¦ãã¾ãã
ã¤ã¾ããã¯ã©ã¤ã¢ã³ããµã¤ãã ããèãããªã大ããªã¡ãªããã¯ãªãã¦ã
SSRã¾ã§èããæã«æ¥½ï¼ã«ãªãå¯è½æ§ãããï¼ã»ã»ã»ã¨ãããã¨ã§ã
ã§ãä»åSSRãããããã¨ã«ããã®ã§ã
ç´ç²ãªWebpackerã使ã£ã¦ãããã»ã©åé¡ã«ã¯ãªãã¾ãã
- jsã®ä¾åé¢ä¿è§£æ±ºã¨çµ±å => ããããWebpackerã®ä»äº
- ã¾ã¨ããjsãRailsã®assetsã¨ãã¦æ±ããããã«ãã => Railså´ã§Sprocketsã使ããªãææ³ãå®è£ ããã¦ããã®ã§ãæ¬è³ªçã«ã¯ä¸è¦
- Rubyã®æèã§æ¸¡ãããã¼ã¿ããReactã®åæpropsã¨ãã¦æ¸¡ã => åæãã¼ã¿ã®å¡ãJSONã§åºåããReactãappendããåã«parseãã¦æ¸¡ã
ä»ã¾ã§ReactOnRailsããã¾ããã¨ãã£ã¦ããã¦ããWebpackerã®ä»çµã¿ã«ã¤ãã¦ã
èªåã§èª¿ã¹ãå¿
è¦ã¯ããã¾ããããããã¾ã§å¤§ããªåé¡ã¯ããã¾ããã§ãã
ã»ã»ã»å°ãªãã¨ãããReactOnRailsãåã£æããã¨ããæèã«ããã¦ã¯(lllï¾Ðï¾)
Webpackerã®è¾ã
åé¡ãä¸æ°ã«åºãã®ã¯ãä½ã¨ãdevelopmentã§ãæ°æã¡æªããã©ä¸å¿åããã¾ã§å°éããã®ã§ã
stagingã§åããã¦ã¿ãããè¨ããããã°ããéç¨ã§ããã¬ãã«ã§æ§ç¯ããããã¨èããæã§ã
ä»ã¾ã§ã¯ReactOnRailsãããæãã«ã³ã¼ãã®å§ç¸®ãzipåããã£ã¦ãã¦ããã¦ããã®ã§ã
ãã¾ãæèãã¦ããªãã£ãã®ã§ãããWebpackerã§èªåã§ãããã¨ããã¨ã
ä¸æ°ã«å¿
è¦ãªæ
å ±ãè¨ãä¸ããã¾ããΣ(ï¾Ðï¾ï¼â¡ï¼ï¾Ð´ï¾)
ãããããWebpackerãã§ã°ã°ã£ã¦ãå
¨ç¶æ
å ±ãåºã¦ããªããã
åºã¦ããæ
å ±ãããªãã§ããããæ¸ãæ¹ã§åãã®ãï¼ããããããªãã¦æ°æã¡æªãããã§ã
ãã£ã¨æã«å
¥ããæ
å ±éãã«è¨å®ãã¦ãåä½ãæ³å®éãã«ãªããã
ããããæ°ããWebpackerããªãªã¼ã¹åã§ãã°ãããããããªã®ãã
ãæ°ããæ¸ãæ¹ãããªãã¨ãã¡ããªã®ããå
¨ãè¦ããªããªãã¾ãã(´-Ï-)
çµè«ã¨ãã¦ããã®è¨äºã®éãã§ã
今日から簡単!Webpacker 完全脱出ガイド - pixiv inside
ãã®è¨äºãèªãã§ãã¡ããã¡ãããªããã¾ãã£ãã®ã§ã
Webpackerãæ¨ã¦ã決æããã¾ãã( ï¾Ðï¾)yâ~~
ã¡ãªã¿ã«ãå¤ä¼ã¿ã®èª²é¡çãªæãã§ãccptsã®ãã¼ã¹ãããã£ã¦ããã®ã ãã©ãçµè«ããããã°webpackerã«æ®ºæãè¦ãã¦åãé¢ããã¨ã«ããã®ã§ãããã¡ãã£ã¨ãããã¾ãΣ(ï¾Ðï¾)カï¾ï½°ï¾
— ã±ãã£ã¨ (@parrot_studio) 2019å¹´8æ11æ¥
ãWebpackãã«ã¤ãã¦ç解ãããã¨ã§ã
ãWebpackerã®DSLããä½ããããã¨ãã¦ããã®ãã¯ç解ãã¾ãããã
Webpackãç解ãã¦ããã ã¨ããã¾ãã«åããã©ãã§ã
ã¢ãããã¼ããé
ãã¦ãWebpackerãä¾åãã¦ããã©ã¤ãã©ãªã®ããã«ã
GitHubããã»ãã¥ãªãã£è¦åãæ¥ã¦ããããã¦ã
ã¢ãããã¼ããæ¥ãªãã¨ã©ãã«ããªããªãã£ããã¨ã
ï¼Webpackã«ç§»è¡ãã¦ãåã©ã¤ãã©ãªãææ°ã«ããããã¡ããè¦åã¯ãªããªãã¾ããï¼
RailsããWebãµã¤ãã«å¿
è¦ãªæè¡çè¦ç´ ãããã«ã¹ã¿ãã¯ã§å®¹æã«ãã¦ããã®ã¯å©ç¹ã§ããã
ã¯ã©ã¤ã¢ã³ããµã¤ãã«ã¤ãã¦ã¯Railsã¨ç¡é¢ä¿ãªãã©ã¯ãã£ã¹ãããµãã¦ããã
ãããRailsã®æèã«ããããå¤æãããã®ã¯ãå®éã®æ¥åã«ããã¦ãé¢åã ã¨æãã¾ã(´-Ï-)
ãwebpack.config.jsããä¸ããç解ãã
ã¨ãããã¨ã§ãç´ç²ãªãWebpackãã«ã¤ãã¦ãä¸ããå¦ãã§ããã¾ãã
webpackのTree Shakingを理解して不要なコードがバンドルされるのを防ぐ - Qiita
Webpackã4ã«ãªã£ã¦ã ãã¶ä½¿ãããããªã£ãããã§ã
modeãã©ã¡ã¼ã¿ãæå®ãããã¨ã§ã
æä½éæ³å®ããå¦çããã¦ãããã¨ããç°¡åã«ãªã£ã¦ãã¾ã
ã¨ã¯ãããä»åã¯ããã¾ã§ãRailsã®ä¸ã§åããããã¨ãåæã§ããã
ãindex.htmlãããã¢ã¯ã»ã¹ãããããã§ã¯ãªãã®ã§ã
ä¸è¬çãªwebãµã¤ãã¨ã¯å°ã
ããæ¹ãç°ãªãã¾ã
ãã¤ã³ãã¯ä»¥ä¸ã§ã
- å ã®Webpackerã«ãããã¦ããapp/javascript/packsããèµ·ç¹ã¨ãã
- ãã«ãããã³ã¼ãããpublic/packsãã«åãåºã
- viewããèªåã§æ¸ããhelperã§ãããjavascript_pack_tagãçãå¼ã³åºã
- Railsã®ããã³ãã«ãããµã¼ãï¼Nginxçï¼ããç´ã«ãpublic/packsã以ä¸ãåç §ããã
1.2.ã®ãã£ã¬ã¯ããªã¯ã©ãã§ãããã®ã§ãããå¼ãå¥ãããã¨ã¯ããRailsã®ããã¸ã§ã¯ããªã®ã§ã
ä¸å¿Webpackerã®ä½æ³ã«åããã¦æ±ºãã¦ããã¾ã
3.ãæ大ã®ãã¤ã³ãã§ãRailsãç¨æãã¦ãããjavascript_pack_tagããèªåã§å®è£ ããå¿ è¦ãããã¾ã
- æå®ãããååããmanifest.jsonãè¦ã¦ãå®ä½ã¨ãªãpathãåå¾ãã
- ãã®pathï¼ãããã¯URLï¼ãRailsã®æèã§åºåãã
å®éã«ã¯ãããªæãã§ã(´・Ïï½¥)ã£
- åèï¼今日から簡単!Webpacker 完全脱出ガイド - pixiv inside
- å®è£ ï¼cc-pt-viewer/webpack_helper.rb at master · parrot-studio/cc-pt-viewer · GitHub
çµæçã«ããã®ãããªã¿ã°ãåºåããã¾ã
<script src="/packs/application-d1623c84a0914a0a63d9.js" defer="defer"></script>
Railsã®ããã©ã«ãè¨å®ã§ã¯public以ä¸ã«ç´ã¢ã¯ã»ã¹ããã¦ãããªãã®ã§ã
Nginxå´ã§ãã®ãããªè¨å®ãå¿
è¦ã§ã*2
location ~ ^/packs/Â { Â root /path/to/public; Â gzip_static on; Â expires max; Â add_header Cache-Control public; }
ããèªä½ã¯ã以åãpublic/assetsãã«å¯¾ãã¦è¨å®ãããã®ã¨å
¨ãåãã§ã
ãã®ä»ãæ°ã«ãªã£ããã¨
ãä¾åãããã¡ã¤ã«ãå
¨ã¦èµ·ç¹ããåç
§ãããå¿
è¦ãããã®ã¯ããããã
ãCSSã¾ã§ä¸ç·ã«ãããã¨ãjsã解éãããã¾ã§CSSãé©ç¨ãããªãã
なんとなくで理解しないWebpackのCSS周辺 - Qiita
GitHub - webpack-contrib/mini-css-extract-plugin: Lightweight CSS extraction plugin
ãfontawesome5ã¯webfontããSVGã«ããæç»ã«å¤ãã£ãããã ãã©ãã
ãjsã§çµã¿è¾¼ã¾ããã®ã§buildãããã¡ã¤ã«ãè¥å¤§åãã¦ãã°ãã
ãReactä¸ã§iã¿ã°ã«ãããã©ã³ãæç»ããããã¨ã
ãåçãªå¤æ´ãå ãã¦ãã«ã¢ã¤ã³ã³ãåºå®ããã¦å¤ãããªãã
1年後に差がつくFont Awesome5 ~フロントエンド開発(ES6,Webpack4,Babel7)への導入~ - Qiita
GitHub - FortAwesome/react-fontawesome: Font Awesome 5 React component
ãproductionã§ãsource-mapãå«ã¾ãã¦ãã¾ã£ã¦ãµã¤ãºãã§ããã
ãããããdevelopmentã§ã ãåºåãã
const config = { // å ±éã®è¨å® } module.exports = (env, argv) => { if (argv.mode === 'development') { config.devtool = "source-map"; // developmentã§ã ã // webpack-dev-serverã®è¨å®ã¨ã } else if (argv.mode === 'production') { // jsã¨ãcssã¨ãzipã§å§ç¸®ããã¨ã } return config; }
ãã®ãç°å¢ãã¨ã«webpack.configããããããDSLçã«ããããã£ãã®ãã
webpackerã®ãconfig/webpackãã ã¨æãã®ã§ããã
ãã®ããã«æ¸ãã°ããã ãã®è©±ãªã®ã§ããã¯ãåé·ã ã¨æãã¾ã(´-Ï-)
ãReactããåç
§ãã¦ããªãããhtmlããåç
§ãã¦ããç»åï¼ä¾ï¼favicon.icoï¼ã
ãWebpackã®buildã«å«ã¾ããªãã
æåã¯èµ·ç¹ã¨ãã¦è¨å®ãã¦ããã®ã§ããã
è¦ã¯èµ·ç¹ã«ãªãjsã«importããã¦ããã°ããã®ã§ãéã«è¿½å ãã¾ãã
// appilication.js import './images/ccpts.png' import './images/favicon.ico'
ããã«ããmanifest.jsonã«ãç»åãç»é²ãããããã
èªåã®helperããããæãã«åç
§ã§ãã¾ã
ãããã¤ã®ä¿®æ£
ä»ãcapistranoã«ãããããã¤ããã¦ããã
以åã¯ãassets:precompileãã®ã¿ã¤ãã³ã°ã§ã
ReactOnRailsãããæãã«buildããã¦ãã¦ããã¾ãã
ããããããWebpackerããã使ã£ã¦ãªãã®ã§ã
ã©ããããã¤ãããã®ãæ©ãã ã®ã§ããã
è¦ããã«ããã¼ã«ã«ã§buildãã¦ãé©åãªpathã«uploadãã§ããããã§ã
# ãã¯ãä¸è¦ # set :assets_roles, :app # set :yarn_roles, :app # set :yarn_flags, '--prefer-offline --silent --no-progress --production' namespace :deploy do namespace :webpack do desc 'build packs' task :build do # æå ã§buildãå®è¡ run_locally do execute "yarn run build:production" end end desc 'upload packs' task :upload do on roles(:app) do within release_path do with rails_env: fetch(:rails_env) do # ãªã¢ã¼ãã«buildãããã¡ã¤ã«ãupload execute "mkdir #{shared_path}/public/packs/images -p" files = [] Dir.glob('public/packs/*').each do |f| files << f if File.file?(f) end images = [] Dir.glob('public/packs/images/*').each do |f| images << f if File.file?(f) end pack_path = "#{shared_path}/public/packs" files.each do |f| upload! f, pack_path end image_path = "#{shared_path}/public/packs/images" images.each do |f| upload! f, image_path end end end end end desc 'build, upload with webpack' task :precompile do invoke 'deploy:webpack:build' invoke 'deploy:webpack:upload' end end before :migrate, 'webpack:precompile' # migrateã®åã«webpacké¢é£ãå®è¡ end
ä»ã¾ã§ã¯ãµã¼ãã§buildãã¦ããã®ã§æéããããã¾ãããã
èªåã®ãã·ã³ã§buildããã°éããã
assetsé¢é£ã®ã¿ã¹ã¯ãå
¨é¨åã£ã¦ããã®ã§ããããã¤ãã·ã³ãã«ã«ãªãã¾ãã
ããã ã¨APãµã¼ãã«yarnã©ãããnodeããããªãã®ã§ã
ãµã¼ãæ§æãã®ãã®ãã·ã³ãã«ã«ãªãã¾ã(ï½ï½¥Ï・´) b
ä»åã®ã¾ã¨ã
ããã¯SSRããããæã«æ°ã¥ãããã¨ã§ããã
SSRã®ããã«ã¯ãµã¼ããµã¤ãã§ã
ç»é¢è¡¨ç¤ºã«å¿
è¦ãªæ
å ±ãå
ã«æããå¿
è¦ãããã¾ãã
ããã¯å½ããåã®ããã§ããã以åã¯ç»é¢ã表示ãã¦ãã
éåæã«ãã¼ã¿ãåãã«è¡ãè¨è¨ã«ãªã£ã¦ãã¾ãã
ããã«ãããã¯ã©ã¤ã¢ã³ãã¨ãµã¼ããµã¤ãã®è²¬åãåãé¢ãã
ããã¨èªç±ã«ã¯ã©ã¤ã¢ã³ããããããããã«ããããã§ã
ããããå½ç¶ãªãããããã¯ã©ã¤ã¢ã³ããé ããªã£ã¦ããåå ã§ãããã¾ã
- ãã¼ã¿åå¾ã®ããã®éä¿¡ãæ°åçºçãã
- åå¾ãããã¼ã¿ã§ç»é¢ãã¬ã³ããªã³ã°ããªããã®ã§ãåæç»ã³ã¹ããããã
SSRãããã¦ããåæ表示ã«å¿
è¦ãªæ
å ±ã渡ããã¨ããè¨è¨ã¯ç¶æããããã
ã¯ã©ã¤ã¢ã³ãã®å¦çã§ã以åã«æ¯ã¹ã¦æ ¼æ®µã«é«éåããã¾ãã(ï½ï½¥Ï・´) b
ï¼æè¡çãªèå³ããã£ãã¨ã¯ããï¼ãã®é度æãªã
é¢åãªSSRã«ãããã¨ã¯æããªãã£ãã¯ãã§ã
ä¸å¨åã£ã¦ãã£ã¨é©åãªè¨è¨ã«ãã©ãçããæ°ããã¾ã
ããã¦ãWebpackã«ã¤ãã¦ã§ããã
webpack.configã«ã¤ãã¦ãã£ã¡ãç解ãã
èªåçæãããã¾ã¾ã ã¨ããã³ããããã ãã®è¨å®ã¯ãªããªãã¾ãã
ãããããä½ããã¦ãã¦ãã©ã®ã¿ã¤ãã³ã°ã§é©ç¨ãããã®ããç解ãã¦ããã®ã§ã
ä½è¨ãªè¨å®ã¯ãªããªããå
¨ä½ãã¹ãªã ã§è¦ããããªãã¾ãã
ãã®çµæãjsãcssã«ãä½è¨ãªã³ã¼ããå«ã¾ããªããªãã
jsã®ãµã¤ãºã ãè¦ã¦ãã1/2以ä¸ã«æ¸ã£ã¦ããã
èµ·åæã®å¾
ã¡æéãã ãã¶æ¸ãã¾ãã¦ãSSRã»ã©ã§ã¯ãªãã«ãã¦ããååé«éã«ãªãã¾ãã*3
ãªã«ããããWebpackã®ç¥èãã¯Railsã¨é¢ä¿ãªãã
ä»ã®ã¢ã¼ããã¯ãã£ã§ãå¿ç¨ã§ããç¥èã§ããã
ããã³ãã¨ã³ãéçºããã¼ã®æ§ç¯ã«å½¹ç«ã¡ã¾ã
ReactOnRailsããªããã°ãããããReactã使ããã¨ãæããªãã£ãã®ã§ã
é常ã«æè¬ã¯ãã¦ãã¾ããããã£ã¨è£å©è¼ªãå¤ãã¦ã
ãæ¬æ¥ã®éç¨ããã§ããããã«ãªã£ãã»ã»ã»ã¨ãããã¨ã§ãã(`ï½¥Ï・´)
*1: å®éã«ã¯ç£è¦ã®è² è·ï¼ã¡ãã£ã¨å¤ãã®ã¢ã¯ã»ã¹ããããã«ããããã¾ã使ããã¦ããªãããåé¡ã«ãªã£ã¦ãªãã£ãã»ã»ã»ã¨ããã ãã§ã(´-Ï-)
*2: productionã®configãä¸ç®ææ¸ãæããã°å¯è½ãªã®ã§ãããããããããã©ã¼ãã³ã¹ã®ããã«ãã®ãããªè¨å®ãããã©ã«ããªã®ã§ãããã«å¾ãæ¹ãé©åã§ã
*3: Googleã®åæã ã¨è¦åãåºã¾ããã¾ãããããããè¤éãªãµã¤ãã§ãããããããç¨åº¦ã¯ããããã¦ã¾ã