From 3dc1ddbff91f559776825fab0ad5dc0cfc4e94e7 Mon Sep 17 00:00:00 2001 From: Alvin Kristanto Date: Wed, 27 Mar 2019 12:02:18 +0700 Subject: [PATCH] docs(compose-plugins): example for using compose plugin (#159) --- example/compose-plugins/RootPage.tsx | 13 +++++++++++++ example/compose-plugins/maleo.config.js | 18 ++++++++++++++++++ example/compose-plugins/package.json | 18 ++++++++++++++++++ example/compose-plugins/routes.json | 6 ++++++ example/compose-plugins/style.css | 3 +++ example/compose-plugins/tsconfig.json | 13 +++++++++++++ 6 files changed, 71 insertions(+) create mode 100644 example/compose-plugins/RootPage.tsx create mode 100644 example/compose-plugins/maleo.config.js create mode 100644 example/compose-plugins/package.json create mode 100644 example/compose-plugins/routes.json create mode 100644 example/compose-plugins/style.css create mode 100644 example/compose-plugins/tsconfig.json diff --git a/example/compose-plugins/RootPage.tsx b/example/compose-plugins/RootPage.tsx new file mode 100644 index 00000000..af36a06e --- /dev/null +++ b/example/compose-plugins/RootPage.tsx @@ -0,0 +1,13 @@ +import React from 'react' + +const style = require('./style.css') + +export default class RootPage extends React.Component { + render() { + return ( +
+

Hello World

+
+ ) + } +} \ No newline at end of file diff --git a/example/compose-plugins/maleo.config.js b/example/compose-plugins/maleo.config.js new file mode 100644 index 00000000..a9fbc73d --- /dev/null +++ b/example/compose-plugins/maleo.config.js @@ -0,0 +1,18 @@ +const cssPlugin = require('@airy/maleo-css-plugin') +const tsPlugin = require('@airy/maleo-typescript-plugin') +const compose = require('@airy/maleo-compose-plugin') + +module.exports = compose([ + [tsPlugin], + [cssPlugin, { + cssPluginOptions: { + extractCss: { + singleCssFile: true, + }, + cssLoader: { + modules: true, + localIdentName: '[path][name]__[local]--[hash:base64:5]' + } + } + }] +]) diff --git a/example/compose-plugins/package.json b/example/compose-plugins/package.json new file mode 100644 index 00000000..d680faf6 --- /dev/null +++ b/example/compose-plugins/package.json @@ -0,0 +1,18 @@ +{ + "name": "compose-plugins", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "scripts": { + "dev": "maleo dev", + "build": "export NODE_ENV=production && maleo build", + "start": "node .maleo/server.js" + }, + "dependencies": { + "@airy/maleo": "^0.0.14", + "@airy/maleo-compose-plugin": "^0.1.0", + "@airy/maleo-css-plugin": "^0.1.3", + "@airy/maleo-typescript-plugin": "^0.0.17", + "react": "^16.8.5" + } +} diff --git a/example/compose-plugins/routes.json b/example/compose-plugins/routes.json new file mode 100644 index 00000000..492d0ff8 --- /dev/null +++ b/example/compose-plugins/routes.json @@ -0,0 +1,6 @@ +[ + { + "path": "/", + "page": "./RootPage" + } +] \ No newline at end of file diff --git a/example/compose-plugins/style.css b/example/compose-plugins/style.css new file mode 100644 index 00000000..532ac566 --- /dev/null +++ b/example/compose-plugins/style.css @@ -0,0 +1,3 @@ +.h1 { + color: red; +} \ No newline at end of file diff --git a/example/compose-plugins/tsconfig.json b/example/compose-plugins/tsconfig.json new file mode 100644 index 00000000..e391aaaf --- /dev/null +++ b/example/compose-plugins/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "./node_modules/@airy/maleo-typescript-plugin/tsconfig.base.json", + "compilerOptions": { + "baseUrl": ".", + "rootDir": "." + }, + "include": [ + "**/*.ts", + "**/*.tsx", + "*/.ts", + "*/.tsx" + ] +} \ No newline at end of file