{"id":2268,"date":"2020-09-24T21:09:45","date_gmt":"2020-09-24T12:09:45","guid":{"rendered":"https:\/\/www.oqiita.com\/?p=2268"},"modified":"2020-09-24T21:09:45","modified_gmt":"2020-09-24T12:09:45","slug":"minify-%e3%81%95%e3%82%8c%e3%81%9f%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92%e3%82%ad%e3%83%ac%e3%82%a4%e3%81%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.oqiita.com\/?p=2268","title":{"rendered":"Minify \u3055\u308c\u305f\u30b3\u30fc\u30c9\u3092\u30ad\u30ec\u30a4\u306b\u3059\u308b"},"content":{"rendered":"<p>\u3069\u3063\u304b\u306e\u8ab0\u304b\u306b\u805e\u304b\u308c\u3066\u8abf\u3079\u305f\u5185\u5bb9\u30e1\u30e2<br \/>\nMinify \u3055\u308c\u305f\u30b3\u30fc\u30c9\u3092 Prettier \u3059\u308b\u65b9\u6cd5<\/p>\n<p><!--more--><\/p>\n<p>GeneXus\u3067\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30b3\u30fc\u30c9\u306f\u57fa\u672c\u5168\u3066Minify\uff08\u30df\u30cb\u30d5\u30a1\u30a4\uff09\u3055\u308c\u3066\u307e\u3059\u3002<\/p>\n<p>JS\u3068\u304bCSS\u306e\u6539\u884c\u3084\u7121\u99c4\u306a\u30a4\u30f3\u30c7\u30f3\u30c8\u3092\u524a\u9664\u3059\u308b\u3053\u3068[\/alert]\n<p>\u305f\u307e\u306b\u52d5\u4f5c\u304c\u304a\u304b\u3057\u3044\u6642\u3068\u304b\u306f<br \/>\n\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u30b3\u30fc\u30c9\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3046\u3044\u3046\u6642\u306f1\u500b2\u500b\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\u306fVSCode\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p><\/p>\n<h3 id=\"i-0\">VS Code<\/h3>\n<p>VSCode\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u300cPrettier \u2013 Code formatter\u300d<br \/>\n\u4f7f\u3044\u65b9\u306f\u5916\u90e8\u30b5\u30a4\u30c8\u3067<br \/>\n<a href=\"https:\/\/ma-vericks.com\/vscode-prettier\/\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/ma-vericks.com\/vscode-prettier\/<\/a><\/p>\n<p>\u3067\u3082\u8907\u6570\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u5408\u306f\u30b3\u30de\u30f3\u30c9\u3067\u4e00\u6c17\u306b\u30ad\u30ec\u30a4\u306b\u3057\u305f\u3044\u5834\u5408\u306f<br \/>\nnode.js \u304b\u3089 prettier\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<h3 id=\"i-1\">node.js<\/h3>\n<p>node.js \u306e prettier\u30e2\u30b8\u30e5\u30fc\u30eb<br \/>\n  <a class=\"reference table\" href=\"https:\/\/github.com\/prettier\/prettier\" target=\"_blank\" rel=\"noopener noreferrer\"><br \/>\n    <span class=\"tbcell refttl\">\u53c2\u8003<\/span><br \/>\n    <span class=\"tbcell refcite\">GitHub \u2013 prettier\/prettier<span>github.com<\/span><\/span><br \/>\n  <\/a><\/p>\n<h4 id=\"i-2\">1.node.js \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>\u7701\u7565\u3002\u9069\u5f53\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3002<br \/>\n<a href=\"https:\/\/nodejs.org\/ja\/\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/nodejs.org\/ja\/<\/a><\/p>\n<h4 id=\"i-3\">2.\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u78ba\u8a8d<\/h4>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u304c\u4f7f\u3048\u308c\u3070\u3001\u554f\u984c\u306a\u304f\u52d5\u304f\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-batch\">node -v\nv12.18.2\n\nnpm -v\n6.14.5\n\nnpx -v\n10.2.2\n<\/code><\/pre>\n<h4 id=\"i-4\">3.prettier\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>\u30ad\u30ec\u30a4\u306b\u3057\u305f\u3044JS\u304c\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306b\u79fb\u52d5\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-batch\">npm install -D prettier<\/code><\/pre>\n<h4 id=\"i-5\">4.prettier\u30b3\u30de\u30f3\u30c9<\/h4>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067Prettier\u3055\u308c\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-batch\">npx prettier --check \"*.js\"<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067js\u30d5\u30a1\u30a4\u30eb\u3092\u4e00\u6c17\u306b\u30ad\u30ec\u30a4\u306b\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"line-numbers\"><code class=\"language-batch\">npx prettier --write \"*.js\"<\/code><\/pre>\n<p>\u7d50\u679c\u306f\u3053\u3093\u306a\u611f\u3058<\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">gx.evt.autoSkip=!1;gx.define(\"webpanel1\",!1,function(){this.ServerClass=\"webpanel1\";this.PackageName=\"GeneXus.Programs\";this.setObjectType(\"web\");this.hasEnterEvent=!1;this.skipOnEnter=!1;this.autoRefresh=!0;this.fullAjax=!0;this.supportAjaxEvents=!0;this.ajaxSecurityToken=!0;this.SetStandaloneVars=function(){};this.e11071_client=function(){return this.clearMessages(),this.addMessage(\"TEST\"),this.refreshOutputs([]),gx.$.Deferred().resolve()};this.e13072_client=function(){return this.executeServerEvent(\"ENTER\",!0,null,!1,!1)};this.e14072_client=function(){return this.executeServerEvent(\"CANCEL\",!0,null,!1,!1)};this.GXValidFnc=[];var n=this.GXValidFnc;this.GXCtrlIds=[2,3,4,5,6];this.GXLastCtrlId=6;n[2]={id:2,fld:\"\",grid:0};n[3]={id:3,fld:\"MAINTABLE\",grid:0};n[4]={id:4,fld:\"\",grid:0};n[5]={id:5,fld:\"\",grid:0};n[6]={id:6,fld:\"TEST\",grid:0,evt:\"e11071_client\"};this.Events={e13072_client:[\"ENTER\",!0],e14072_client:[\"CANCEL\",!0],e11071_client:[\"'TEST'\",!1]};this.EvtParms.REFRESH=[[],[]];this.EvtParms[\"'TEST'\"]=[[],[]];this.Initialize()});gx.wi(function(){gx.createParentObj(webpanel1)})\n<\/code><\/pre>\n<p>\u2193<\/p>\n<pre class=\"line-numbers\"><code class=\"language-js\">gx.evt.autoSkip = !1;\ngx.define(\"webpanel1\", !1, function () {\n  this.ServerClass = \"webpanel1\";\n  this.PackageName = \"GeneXus.Programs\";\n  this.setObjectType(\"web\");\n  this.hasEnterEvent = !1;\n  this.skipOnEnter = !1;\n  this.autoRefresh = !0;\n  this.fullAjax = !0;\n  this.supportAjaxEvents = !0;\n  this.ajaxSecurityToken = !0;\n  this.SetStandaloneVars = function () {};\n  this.e11071_client = function () {\n    return (\n      this.clearMessages(),\n      this.addMessage(\"TEST\"),\n      this.refreshOutputs([]),\n      gx.$.Deferred().resolve()\n    );\n  };\n  this.e13072_client = function () {\n    return this.executeServerEvent(\"ENTER\", !0, null, !1, !1);\n  };\n  this.e14072_client = function () {\n    return this.executeServerEvent(\"CANCEL\", !0, null, !1, !1);\n  };\n  this.GXValidFnc = [];\n  var n = this.GXValidFnc;\n  this.GXCtrlIds = [2, 3, 4, 5, 6];\n  this.GXLastCtrlId = 6;\n  n[2] = { id: 2, fld: \"\", grid: 0 };\n  n[3] = { id: 3, fld: \"MAINTABLE\", grid: 0 };\n  n[4] = { id: 4, fld: \"\", grid: 0 };\n  n[5] = { id: 5, fld: \"\", grid: 0 };\n  n[6] = { id: 6, fld: \"TEST\", grid: 0, evt: \"e11071_client\" };\n  this.Events = {\n    e13072_client: [\"ENTER\", !0],\n    e14072_client: [\"CANCEL\", !0],\n    e11071_client: [\"'TEST'\", !1],\n  };\n  this.EvtParms.REFRESH = [[], []];\n  this.EvtParms[\"'TEST'\"] = [[], []];\n  this.Initialize();\n});\ngx.wi(function () {\n  gx.createParentObj(webpanel1);\n});\n<\/code><\/pre>\n<h3 id=\"i-6\">\u30aa\u30d7\u30b7\u30e7\u30f3\u30d5\u30a1\u30a4\u30eb<\/h3>\n<p>\u2191\u3060\u3068\u30a4\u30f3\u30c7\u30f3\u30c8\u304c\u30b9\u30da\u30fc\u30b92\u500b\u3067\u3059\u304c\u30014\u500b\u306b\u8a2d\u5b9a\u3092\u5909\u3048\u3066\u3001\u518d\u5b9f\u884c\u3002<br \/>\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306fnode_modules\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3068\u540c\u3058\u968e\u5c64\u306b\u914d\u7f6e\u3002<\/p>\n<p>\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u9805\u76ee\u306f\u4ee5\u4e0b\u3092\u53c2\u8003\u306b\u6307\u5b9a<br \/>\n<a href=\"https:\/\/prettier.io\/docs\/en\/options.html\" rel=\"noopener noreferrer\" target=\"_blank\">https:\/\/prettier.io\/docs\/en\/options.html<\/a><\/p>\n<div class=\"pre_tag\"><span><i class=\"fa fa-code\"><\/i> .prettierrc<\/span><\/p>\n<pre class=\"line-numbers\"><code class=\"language-json\">{\n    tabWidth : 4,\n    semi : true\n}\n<\/code><\/pre>\n<\/div>\n<pre class=\"line-numbers\"><code class=\"language-js\">gx.evt.autoSkip = !1;\ngx.define(\"webpanel1\", !1, function () {\n    this.ServerClass = \"webpanel1\";\n    this.PackageName = \"GeneXus.Programs\";\n    this.setObjectType(\"web\");\n    this.hasEnterEvent = !1;\n    this.skipOnEnter = !1;\n    this.autoRefresh = !0;\n    this.fullAjax = !0;\n    this.supportAjaxEvents = !0;\n    this.ajaxSecurityToken = !0;\n    this.SetStandaloneVars = function () {};\n    this.e11071_client = function () {\n        return (\n            this.clearMessages(),\n            this.addMessage(\"TEST\"),\n            this.refreshOutputs([]),\n            gx.$.Deferred().resolve()\n        );\n    };\n    this.e13072_client = function () {\n        return this.executeServerEvent(\"ENTER\", !0, null, !1, !1);\n    };\n    this.e14072_client = function () {\n        return this.executeServerEvent(\"CANCEL\", !0, null, !1, !1);\n    };\n    this.GXValidFnc = [];\n    var n = this.GXValidFnc;\n    this.GXCtrlIds = [2, 3, 4, 5, 6];\n    this.GXLastCtrlId = 6;\n    n[2] = { id: 2, fld: \"\", grid: 0 };\n    n[3] = { id: 3, fld: \"MAINTABLE\", grid: 0 };\n    n[4] = { id: 4, fld: \"\", grid: 0 };\n    n[5] = { id: 5, fld: \"\", grid: 0 };\n    n[6] = { id: 6, fld: \"TEST\", grid: 0, evt: \"e11071_client\" };\n    this.Events = {\n        e13072_client: [\"ENTER\", !0],\n        e14072_client: [\"CANCEL\", !0],\n        e11071_client: [\"'TEST'\", !1],\n    };\n    this.EvtParms.REFRESH = [[], []];\n    this.EvtParms[\"'TEST'\"] = [[], []];\n    this.Initialize();\n});\ngx.wi(function () {\n    gx.createParentObj(webpanel1);\n});\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3069\u3063\u304b\u306e\u8ab0\u304b\u306b\u805e\u304b\u308c\u3066\u8abf\u3079\u305f\u5185\u5bb9\u30e1\u30e2 Minify \u3055\u308c\u305f\u30b3\u30fc\u30c9\u3092 Prettier \u3059\u308b\u65b9\u6cd5<\/p>\n","protected":false},"author":1,"featured_media":743,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[9],"tags":[37,270,271,273,272],"class_list":{"0":"post-2268","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-node-js","8":"tag-genexus","9":"tag-js","10":"tag-prettier","11":"tag-273","12":"tag-272","13":"entry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.oqiita.com\/wp-content\/uploads\/2017\/06\/sango_nodejs_icatch.png","jetpack_shortlink":"https:\/\/wp.me\/p8QluP-AA","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2268"}],"version-history":[{"count":10,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2268\/revisions"}],"predecessor-version":[{"id":2283,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/posts\/2268\/revisions\/2283"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=\/wp\/v2\/media\/743"}],"wp:attachment":[{"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oqiita.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}