1.0.3 • Published 6 months ago

frag-components v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Frag Components

The perfect library to create SPA (Single Page Applications)

For Developers

1 - Starting a new app using npx:

  npx create-frag-app my-app

2 - Read the docs: Frag Components Wiki for developers

Example

import { jsx, fragment, FragComponent, virtualDOM } from "frag-components";

class App extends FragComponent {
  render() {
    return (
      <div id="app">
        <h1>Hello World!</h1>
      </div>
    );
  }
}

const Root = new App();

virtualDOM.render(Root);

For Contributors

Frag Components is a Open Source library and you can be a contributor

1 - Use the GitHub issues to report bugs and fixes:

Frag Components Issues

2 - See the contributors docs

See the Frag Components Wiki: Frag Components Wiki for contributors

Getting Started

1- Clone the repo

  git clone https://github.com/IgorSprovieri/frag-components.git

2- Install dependecies:

npm install

3- Create dist/index.html file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script src="bundle.js"></script>
</html>

4- Create .babelrc file:

{
  "presets": ["@babel/preset-env"],
  "plugins": [
    [
      "@babel/plugin-transform-react-jsx",
      {
        "pragma": "jsx",
        "pragmaFrag": "fragment"
      }
    ]
  ]
}

5- Create webpack.config.js file:

const path = require("path");

module.exports = {
  mode: "development",
  entry: "./test/index.js",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bundle.js",
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
        },
      },
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
    ],
  },
  devServer: {
    static: [
      {
        directory: path.join(__dirname, "dist"),
        publicPath: "/",
      },
    ],
    compress: true,
    port: 3000,
  },
};

6- Create test/index.js file:

import { jsx, fragment, FragComponent, virtualDOM } from "../index";

class App extends FragComponent {
  render() {
    return <></>;
  }
}

const Root = new App();

virtualDOM.render(Root);

7- Build the project

npm run build

8- Start the project

npm run start
1.0.3

6 months ago

1.0.0-beta.2

7 months ago

1.0.0-beta.1

7 months ago

1.0.0-alpha.3

7 months ago

1.0.0-alpha.2

7 months ago

1.0.0-alpha.1

7 months ago

1.0.0-beta.0

9 months ago

0.1.6

9 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago