Code Monkey home page Code Monkey logo

modular-js's Introduction

Modular Javascript - A Custom Javascript Generator for Haxe

Quite simply, the modular-js generator will output AMD modules for each class in your Haxe application. The filename is generated from the parent package of each class.

Usage

  1. Install modular-js with haxelib
haxelib install modular-js
  1. Add the generator in your HXML file.
-lib modular-js
  1. You must specify all of the classes of all the dynamic entry points in your hxml file. This tells the compiler to consider each class for Dead Code Elimination when outputting the files of the Haxe Standard Library.

FAQ

  1. Why would you do this?

There are many good reasons to split your project into modules.

  • The vast majority of websites have multiple entry-points (web pages). Javascript modules allow you to share code between these entry-points, with existing code and with web-workers.
  • There is less code to push to the browser when you publish updates.
  • Debugging is easier because files are logically separated.
  • Processing your Javascript is easier with tools like Webpack or Browserify.
  1. Won't loading multiple files make my website slower?

In short, no. The longer answer is, if your server is configured to use SPDY or HTTPS2 and your target browser audience supports one of them, then the slow-down caused by multiple files is not even worth mentioning. To learn more about techniques of making your website load quickly, watch Jake Archibald's talk here.

Known Issues

  • Using -debug will not generate source-maps. (But the javascript output is uncompressed and very readable so fixing this is a low priority.)

TODO

  • ES6 Modules
  • CommonJS Modules

modular-js's People

Contributors

explorigin avatar jgranick avatar kevinresol avatar

Watchers

 avatar  avatar

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.