8000 GitHub - electron-userland/electron-compile at 0.4.0
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications

Notifications You must be signed in to change notification settings

electron-userland/electron-compile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electron-compile

electron-compile provides compilers for common JavaScript and CSS alternative targets.

For JavaScript:

  • JavaScript ES6/ES7 (via Babel)
  • TypeScript
  • CoffeeScript

For CSS:

  • LESS
  • Sass/SCSS

How does it work?

Put this in your Electron app's app.ready:

app.on('ready', function() {
  require('electron-compile').init();
});

From then on, you can now simply include files directly in your HTML, no need for cross-compilation:

<head>
  <script src="main.coffee"></script>
  <link rel="stylesheet" type="text/css" href="main.less" />
</head>

or just require them in:

require('./mylib')   // mylib.ts

Does this work in node.js / io.js too?

The JavaScript compilers will register with module.register, but CSS of course won't

Babel keeps running on my ES5 source

Add 'use nobabel'; to the top of your file to opt-out of Babel compilation.

Hey, why doesn't this work in my main.js file?

Unfortunately, the very first file that you set up app.ready in must be written in ES5. Of course, you can always make this file as small as possible, or just require in a real file once you call init().

About

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published
0