Coder Social home page Coder Social logo

feathersui / webpack-openfl-loader Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 43 KB

A Webpack loader for OpenFL and Feathers UI projects targeting html5

License: Other

JavaScript 100.00%
feathers-ui haxe openfl webpack webpack-loader openfl-target-html5

webpack-openfl-loader's Introduction

OpenFL Loader for Webpack

A custom loader to build OpenFL (and Feathers UI) projects with Webpack.

Usage

Create a new directory for your project.

Create the necessary files for an OpenFL project, including project.xml inside the project's root directory and your .hx source files. Then, follow the remaining steps to setup Webpack and openfl-loader.

In a terminal, run the following command in the root of your project to create a package.json file:

npm init -y

Then, run the following command to install the required dependencies:

npm install --save-dev webpack-cli webpack-dev-server openfl-loader

Open the package.json file, and modify the scripts section:

"scripts": {
  "start": "webpack serve --mode=development",
  "build": "webpack --mode=production"
}

Create a webpack.config.js file in the root of your project:

module.exports = {
  entry: "./project.xml",
  output: {
    // change xyz to an appropriate name for your project
    filename: "xyz.bundle.js",
  },
  module: {
    rules: [
      {
        test: /\/project\.xml$/,
        use: [
          {
            loader: "openfl-loader",
          },
        ],
      },
    ],
  },
};

Create a public/index.html file. Look inside samples/basic sample for an example that's easy to copy with minor modifications.

In particular, you need to change the basic.bundle.js path to the same output file name used in webpack.config.js:

<!--
  This bundle file name is defined in webpack.config.js
-->
<script src="./basic.bundle.js"></script>

And you need to change the lime.embed() call to pass the same app file name used in project.xml.

/*
  the first argument passed to lime.embed() is the
  <app file="******"/> value from project.xml
*/
lime.embed("WebpackBasicSample", "openfl-content", 0, 0, {
  parameters: {},
});

To start a local development server, run the following command. Then, open http://localhost:8080/ in a web browser.

npm start

To build a production JavaScript bundle, run the following command:

npm run build

webpack-openfl-loader's People

Contributors

joshtynjala avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

webpack-openfl-loader's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.