소스 검색

Adding text and css plugins

bodicsek 7 년 전
부모
커밋
39da1255cb
7개의 변경된 파일32개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 0
      package-lock.json
  2. 6 4
      package.json
  3. 3 0
      src/amd/component/hello.css
  4. 1 0
      src/amd/component/hello.html
  5. 6 0
      src/amd/component/hello.ts
  6. 3 0
      src/app.ts
  7. 3 0
      src/systemjs.config.ts

+ 10 - 0
package-lock.json

@@ -1364,6 +1364,16 @@
         }
       }
     },
+    "systemjs-plugin-css": {
+      "version": "0.1.37",
+      "resolved": "https://registry.npmjs.org/systemjs-plugin-css/-/systemjs-plugin-css-0.1.37.tgz",
+      "integrity": "sha512-wCGG62zYXuOlNji5FlBjeMFAnLeAO/HQmFg+8UBX/mlHoAKLHlGFYRstlhGKibRU2oxk/BH9DaihOuhhNLi7Kg=="
+    },
+    "systemjs-plugin-text": {
+      "version": "0.0.11",
+      "resolved": "https://registry.npmjs.org/systemjs-plugin-text/-/systemjs-plugin-text-0.0.11.tgz",
+      "integrity": "sha512-buWE27P6iM3WZYXcsiy6+fiulQ/x+Puux4ni5ejTlcUgqUg3/sUvoAUZ4GGPACC0acjxmnaCt3kHb0+uNs1ekw=="
+    },
     "to-fast-properties": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",

+ 6 - 4
package.json

@@ -10,9 +10,9 @@
     "build:commonjs": "tsc -p src/commonjs",
     "build:amd": "tsc -p src/amd",
     "copy": "npm run copy:assets && npm run copy:libs",
-    "copy:assets": "cpy '**/*.html' '../build/' --cwd=src --parents",
-    "copy:libs": "cpy 'systemjs/dist/*' '../build/libs/' --cwd=node_modules --parents && cpy 'fp-ts/lib/*' '../build/libs/' --cwd=node_modules --parents",
-    "dist": "rimraf dist && node systemjs.build.js && cpy '**/*.html' '../dist/' --cwd=build --parents && cpy 'libs/systemjs/dist/*' '../dist/' --cwd=build --parents && cpy 'systemjs.config.js' '../dist/' --cwd=build --parents",
+    "copy:assets": "cpy '**/*.html' '../build/' --cwd=src --parents && cpy '**/*.css' '../build/' --cwd=src --parents",
+    "copy:libs": "cpy 'systemjs/dist/*' '../build/libs/' --cwd=node_modules --parents && cpy 'fp-ts/lib/*' '../build/libs/' --cwd=node_modules --parents && cpy 'systemjs-plugin-text/*.js' '../build/libs/' --cwd=node_modules --parents && cpy 'systemjs-plugin-css/*.js' '../build/libs/' --cwd=node_modules --parents",
+    "dist": "rimraf dist && node systemjs.build.js && cpy '**/index.html' '../dist/' --cwd=build --parents && cpy 'libs/systemjs/dist/*' '../dist/' --cwd=build --parents && cpy 'systemjs.config.js' '../dist/' --cwd=build --parents",
     "serve:dev": "http-server -p 9090 build/",
     "serve:dist": "http-server -p 9091 dist/"
   },
@@ -31,6 +31,8 @@
   },
   "dependencies": {
     "fp-ts": "^1.4.1",
-    "systemjs": "^0.21.0"
+    "systemjs": "^0.21.0",
+    "systemjs-plugin-css": "^0.1.37",
+    "systemjs-plugin-text": "0.0.11"
   }
 }

+ 3 - 0
src/amd/component/hello.css

@@ -0,0 +1,3 @@
+h1 {
+    color: brown;
+}

+ 1 - 0
src/amd/component/hello.html

@@ -0,0 +1 @@
+<h1>Hello World!</h1>

+ 6 - 0
src/amd/component/hello.ts

@@ -0,0 +1,6 @@
+import "text!./hello.html"
+import "css!./hello.css"
+
+export const render = () => {
+    console.log("rendering amd component");
+}

+ 3 - 0
src/app.ts

@@ -1,6 +1,7 @@
 import { ICounter } from "./common/interfaces";
 import { CommonJsCounter } from "./commonjs/module1";
 import { AmdCounter } from "./amd/module2";
+import { render } from "./amd/component/hello"
 import { SystemJsCounter } from "./systemjs/module3";
 import { some } from "fp-ts/lib/Option";
 
@@ -16,3 +17,5 @@ testCounter(new AmdCounter(10));
 testCounter(new SystemJsCounter(15));
 
 console.log(JSON.stringify(some(5).map(x => x + 1)));
+
+render();

+ 3 - 0
src/systemjs.config.ts

@@ -1,9 +1,12 @@
 SystemJS.config({
+    pluginFirst: true,
     packages: {
         ".": {
         }
     },
     map: {
+        "text": "libs/systemjs-plugin-text/text",
+        "css": "libs/systemjs-plugin-css/css",
         "fp-ts": "libs/fp-ts"
     }
   });