Skip to content

Commit

Permalink
docs(compose-plugins): example for using compose plugin (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinkl committed Mar 28, 2019
1 parent 4411b6e commit 3dc1ddb
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
13 changes: 13 additions & 0 deletions example/compose-plugins/RootPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'

const style = require('./style.css')

export default class RootPage extends React.Component {
render() {
return (
<div>
<h1 className={style.h1}>Hello World</h1>
</div>
)
}
}
18 changes: 18 additions & 0 deletions example/compose-plugins/maleo.config.js
Original file line number Diff line number Diff line change
@@ -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]'
}
}
}]
])
18 changes: 18 additions & 0 deletions example/compose-plugins/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
6 changes: 6 additions & 0 deletions example/compose-plugins/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"path": "/",
"page": "./RootPage"
}
]
3 changes: 3 additions & 0 deletions example/compose-plugins/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.h1 {
color: red;
}
13 changes: 13 additions & 0 deletions example/compose-plugins/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "./node_modules/@airy/maleo-typescript-plugin/tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "."
},
"include": [
"**/*.ts",
"**/*.tsx",
"*/.ts",
"*/.tsx"
]
}

0 comments on commit 3dc1ddb

Please sign in to comment.