0.0.2 • Published 2 years ago

@cosmosreverse/cosmos v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Cosmos-Reverse

  • Use stencil to build a cross-platform components

Useage

  • In vanilla js:
<script src="https://cdn.jsdelivr.net/npm/@cosmosreverse/cosmos@latest/dist/cosmos-reverse/cosmos-reverse.js"></script>

<body>
  <todo-list todo-title="Here"></todo-list>
</body>
  • In React:
// Install
// yarn add @cosmosreverse/cosmos @cosmosreverse/cosmos-react

import { defineCustomElements } from '@cosmosreverse/cosmos/dist/loader';
import { TodoList } from '@cosmosreverse/cosmos-react';

defineCustomElements();
const Example: FC = () => {
  return <TodoList todoTitle="todo-title" />;
};
  • In nextjs:

    需要做一个额外的操作:安装 next-transpile-modules ,进而从 node_modules 中转换未转换的模块

// In next.config.js
const withTM = require('next-transpile-modules');

module.exports = withTM(['some modules'])({
  // ....
});