{"id":222,"date":"2018-08-04T02:25:35","date_gmt":"2018-08-04T02:25:35","guid":{"rendered":"http:\/\/windows.emacslisp.com\/?p=222"},"modified":"2018-08-04T02:43:47","modified_gmt":"2018-08-04T02:43:47","slug":"222","status":"publish","type":"post","link":"http:\/\/windows.emacslisp.com\/index.php\/2018\/08\/04\/222\/","title":{"rendered":"Typescript &#8211; tsc didn&#8217;t copy .html .css .txt to destination folder"},"content":{"rendered":"<p>  tsc would translate .ts file to js and keep folder struction.<br \/>\n  however, for some special file for tsc, such as .txt, .html, .css, tsc command chooses to ignore them.<\/p>\n<p>  we have to copy manually<\/p>\n<p>  for cross-platform, we are using node.js copyfiles package to do it.<\/p>\n<p>  but &#8216;copyfiles .\/src\/**\/*.txt .\/dist&#8217; won&#8217;t work, the final result of that command is all text file would go under &#8216;.\/dist\/src\/path\/to\/file.txt&#8217;<\/p>\n<p>  but luckily copyfiles has options to handle and it is key reason why we uses it beside cross-platform.<\/p>\n<p>  in package.json add<\/p>\n<pre lang=\"json\" line=\"1\">\r\n  \"scripts\": {\r\n    ...\r\n    \"copy-template\": \"copyfiles -u 1 .\/src\/**\/*.txt .\/dist\"\r\n    ...\r\n  }\r\n <\/pre>\n<p> another way to is to use gulpfiles.js and gulp command line.<\/p>\n<pre lang=\"json\" line=\"1\">\r\ngulp.task('copy-template', function() {\r\n     return gulp.src('.\/src\/**\/*.txt', {base: '.\/src'})\r\n            .pipe(gulp.dest('.\/dist'));\r\n});\r\n<\/pre>\n<p>later on, add package.json to invoke this gulpfiles.js<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tsc would translate .ts file to js and keep folder struction. however, for some special file for tsc, such as .txt, .html, .css, tsc command chooses to ignore them. we have to copy manually for cross-platform, we are using node.js &hellip; <a href=\"http:\/\/windows.emacslisp.com\/index.php\/2018\/08\/04\/222\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/posts\/222"}],"collection":[{"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/comments?post=222"}],"version-history":[{"count":2,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions"}],"predecessor-version":[{"id":224,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/posts\/222\/revisions\/224"}],"wp:attachment":[{"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/media?parent=222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/categories?post=222"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/windows.emacslisp.com\/index.php\/wp-json\/wp\/v2\/tags?post=222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}