Coder Social home page Coder Social logo

zio-scalajs's Introduction

Simple ZIO ScalaJS Skeleton

Here's an app skeleton that brings together the following frameworks:

Features:

  • Code hotswapping
  • Static server

Scripts

npm install

Install Dependencies.

npm test

Run unit tests.

npm run build:dev

Compile the app for development.

npm start

Serves all HTML/JS/CSS and watches all changes to build/*.js.

Note: UI is running at http://0.0.0.0:8080//.

npm run build

Compile the app and make it ready for production deployment.

Directory Structure

.
├── node_modules
├── project
├── public
├── src
├── LICENSE
├── .scalafmt.conf
├── build.sbt
├── package-lock.json
├── package.json
├── sbt
├── webpack.config.js
└── README.md
  1. node_modules/: Contains all Nodejs modules.
  2. project/: Defines Scala build properties.
  3. public/: Contains index.html template.
  4. LICENSE: MIT License.
  5. .scalafmt.conf: Code formatter config for Scala.
  6. build.sbt: Defines Scala build.
  7. package-lock.json: MIT License.
  8. package.json - Configures JS dependencies and scripts.
  9. sbt - SBT runner.
  10. webpack.config.js - Bundles JS and builds index.html.

JS Facades

Global libraries

Add the CDN script to public/index.html:

Example using JQuery library:

<script
  src="https://code.jquery.com/jquery-3.6.0.js"
  integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk="
  crossorigin="anonymous"></script>
@js.native
@JSGlobal("jQuery")
object JQuery extends js.Object {
  def apply(x: String): JQuery = js.native
}

NPM module

Example using MomentJS:

npm i moment
@js.native
trait Moment extends js.Object {
  def apply(): Moment = js.native
}

@js.native
@JSImport("moment", "moment")
object Moment extends Moment

zio-scalajs's People

Contributors

sb-dev avatar

Stargazers

Mario KB avatar Mikal Callahan avatar Rohan Verma avatar efim avatar Shahed avatar dabbibi avatar

Watchers

James Cloos avatar  avatar

Forkers

gvlpedro gasdia73

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.