angulate2-scalajs-bundler

1.0.3 • Public • Published

angulate2-scalajs-bundler

Simplyfies the usage of angulate2 with the scalajs-bundler

Usage:

  1. Create a scalajs project https://www.scala-js.org/tutorial/basic/
  2. Add scalajs-bundler to your project: https://scalacenter.github.io/scalajs-bundler/getting-started.html
  3. Add angulate2 to your Project: https://github.com/jokade/angulate2. You have to skip the section Build and run with System.js
  4. Add the angular2 dependencies to your build.sbt:
npmDependencies in Compile += "@angular/common" -> "~2.4.0"
npmDependencies in Compile += "@angular/compiler" -> "~2.4.0"
npmDependencies in Compile += "@angular/core" -> "~2.4.0"
npmDependencies in Compile += "@angular/forms" -> "~2.4.0"
npmDependencies in Compile += "@angular/http" -> "~2.4.0"
npmDependencies in Compile += "@angular/platform-browser" -> "~2.4.0"
npmDependencies in Compile += "@angular/platform-browser-dynamic" -> "~2.4.0"
npmDependencies in Compile += "@angular/router" -> "~3.4.0"
npmDependencies in Compile += "@angular/upgrade" -> "~2.4.0"
npmDependencies in Compile += "core-js" -> "~2.4.1"
npmDependencies in Compile += "rxjs" -> "~5.0.1"
npmDependencies in Compile += "zone.js" -> "0.7.4"
  1. Add angulate2-scalajs-bundler as development dependency to your project:
npmDevDependencies in Compile += "angulate2-scalajs-bundler" -> "1.0.3"
  1. Add a webpack.config.js to your project root:
angulate2ScalaJsBundler = require("angulate2-scalajs-bundler");
module.exports = require('./scalajs.webpack.config');
module.exports.context = __dirname;
angulate2ScalaJsBundler.apply("your-sbt-project-name", module);

  1. Tell scalajs-bundler to use your webpack config, add this line to your build.sbt:
webpackConfigFile in fastOptJS := Some(baseDirectory.value  / "webpack.config.js")
  1. Add a folder called web to yor project root which has at least to contain a index.html, in which you reference any css file you want to use, e.g:
<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Title</title>
   <link rel="stylesheet" href="./styles/main.css">
</head>
<body>
   <app></app><!--Component selector-->
</body>
</html>
  1. Run fastOptJS::webpack your bundled files should appear at project-root/target/scala-{version}/scalajs-bundler/main/dist

Package Sidebar

Install

npm i angulate2-scalajs-bundler

Weekly Downloads

0

Version

1.0.3

License

MIT

Last publish

Collaborators

  • cedware