/cheerio

Tiny, fast, and elegant implementation of core jQuery designed specifically for the server

Primary LanguageScalaApache License 2.0Apache-2.0

Cheerio API for Scala.js

cheerio - A tiny, fast, and elegant implementation of core jQuery designed specifically for the server.

Description

Fast, flexible & lean implementation of core jQuery designed specifically for the server.

Build Requirements

Build/publish the SDK locally

 $ sbt clean publish-local

Running the tests

Before running the tests the first time, you must ensure the npm packages are installed:

$ npm install

Then you can run the tests:

$ sbt test

Examples

import io.scalajs.npm.cheerio._

val input = """<h2 class="title">Hello world</h2>"""
val $ = Cheerio.load(input)

$("h2.title").text("Hello there!")
$("h2").addClass("welcome")

val output = $.html()
println(s"after:  $output") // => <h2 class="title welcome">Hello there!</h2>

Artifacts and Resolvers

To add the Cheerio binding to your project, add the following to your build.sbt:

libraryDependencies += "io.scalajs.npm" %%% "cheerio" % "0.5.0"

Optionally, you may add the Sonatype Repository resolver:

resolvers += Resolver.sonatypeRepo("releases")