angulate2-scalajs-bundler
v1.0.3
Published
Simplyfies the usage of angulate2 with the scalajs-bundler
Downloads
5
Maintainers
Readme
angulate2-scalajs-bundler
Simplyfies the usage of angulate2 with the scalajs-bundler
Usage:
- Create a scalajs project https://www.scala-js.org/tutorial/basic/
- Add scalajs-bundler to your project: https://scalacenter.github.io/scalajs-bundler/getting-started.html
- Add angulate2 to your Project: https://github.com/jokade/angulate2. You have to skip the section Build and run with System.js
- 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"
- Add angulate2-scalajs-bundler as development dependency to your project:
npmDevDependencies in Compile += "angulate2-scalajs-bundler" -> "1.0.3"
- 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);
- Tell scalajs-bundler to use your webpack config, add this line to your build.sbt:
webpackConfigFile in fastOptJS := Some(baseDirectory.value / "webpack.config.js")
- 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>
- Run fastOptJS::webpack your bundled files should appear at project-root/target/scala-{version}/scalajs-bundler/main/dist