All Projects → McFoggy → Cssfx

McFoggy / Cssfx

Licence: apache-2.0
Allow runtime modification of JavaFX CSS

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cssfx

Systemjs Hmr
Hot Module Replacement for SystemJS
Stars: ✭ 24 (-74.74%)
Mutual labels:  hot-reloading, hot-reload
Playgrounds
Better playgrounds that work both for Objective-C and Swift
Stars: ✭ 2,586 (+2622.11%)
Mutual labels:  hot-reloading, hot-reload
Systemjs Hot Reloader
reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
Stars: ✭ 215 (+126.32%)
Mutual labels:  hot-reloading, hot-reload
systemjs-tools
(dev)tools for working with SystemJS
Stars: ✭ 41 (-56.84%)
Mutual labels:  hot-reloading, hot-reload
Jet Live
c++ hot code reload for linux and macos
Stars: ✭ 283 (+197.89%)
Mutual labels:  hot-reloading, hot-reload
active reloader rb
Rails gem that reloads browser as soon as any file is changed
Stars: ✭ 11 (-88.42%)
Mutual labels:  hot-reloading, hot-reload
hot-reload
Hot reload development for Go
Stars: ✭ 72 (-24.21%)
Mutual labels:  hot-reloading, hot-reload
Crx Hotreload
Chrome Extension Hot Reloader
Stars: ✭ 545 (+473.68%)
Mutual labels:  hot-reloading, hot-reload
Hr4r
Example project - "Hot Reloading 4 RequireJS" front-end web applications & some extra code demonstrating hot-reloading for Node.js Express servers
Stars: ✭ 28 (-70.53%)
Mutual labels:  hot-reloading, hot-reload
Scalaonandroid
A tutorial and examples of how to write Android apps in Scala 2.13
Stars: ✭ 61 (-35.79%)
Mutual labels:  javafx
Fx Experience
fx-experience -> fx onscreen keyboard
Stars: ✭ 72 (-24.21%)
Mutual labels:  javafx
Fx Guice
Google Guice integration for FXML-based JavaFX applications
Stars: ✭ 61 (-35.79%)
Mutual labels:  javafx
Owlplug
Audio plugin manager. Small tool to manage VST plugin folders on Windows and MacOS.
Stars: ✭ 64 (-32.63%)
Mutual labels:  javafx
Jrebirth
JRebirth is a JavaFX Application Framework
Stars: ✭ 74 (-22.11%)
Mutual labels:  javafx
Fxmaterialdesign
JavaFx Material Design Models (UI/UX) 🎉
Stars: ✭ 63 (-33.68%)
Mutual labels:  javafx
The Ultimate Boilerplate
webpack 2, react hotloader 3, react router v4, code splitting and more
Stars: ✭ 85 (-10.53%)
Mutual labels:  hot-reloading
Editor
基于JavaFx的Markdown编辑器
Stars: ✭ 61 (-35.79%)
Mutual labels:  javafx
Gamecomposer
GameComposer is a game authoring tool and also a game runtime environment targeting at desktop and mobile devices.
Stars: ✭ 59 (-37.89%)
Mutual labels:  javafx
Boot Reload
Boot task providing live-reload of browser css, images, etc.
Stars: ✭ 90 (-5.26%)
Mutual labels:  hot-reload
Proscalafx
Pro JavaFX2 book source codes translated to ScalaFX
Stars: ✭ 83 (-12.63%)
Mutual labels:  javafx

cssfx

Build Status Maven Central Open Hub project report for CSSFX

⚠ WARNING ⚠

In version 11.3.0 we have relocated & refactored the project.

  • maven groupId has been changed to fr.brouillard.oss
  • java module name has been changed from cssfx to fr.brouillard.oss.cssfx
  • classes package has been changed from org.fxmisc.cssfx to fr.brouillard.oss.cssfx

⚠ WARNING ⚠

CSSFX enhances developer productivity by providing CSS reloading functionality in your running application.

While developing you can run your JavaFX application, modify some CSS sources in your preferred editor, hit save button (or CTLR+S or CMD-S) and your JavaFX application is modified in real time.

CSSFX YouTube demo

Project coordinates

Java >= 11

Versions compatible with JavaFX 11 start with 11.X.
Find latest version on central or old ones before relocation.

Maven

<dependency>
  <groupId>fr.brouillard.oss</groupId>
  <artifactId>cssfx</artifactId>
  <version>11.4.0</version>
</dependency>

Gradle

dependencies {
    compile "fr.brouillard.oss:cssfx:11.4.0"
}

Modular Java

CSSFX does not currently provide a module descriptor, but it defines its module name fr.brouillard.oss.cssfx.
If you wish to use CSSFX from a modular javafx application you will need to require it for the moment as an automatic module.

// module-info.java 
module your.module.name {
  requires fr.brouillard.oss.cssfx;
}

Java 8

Versions compatible with JavaFX 8 are all 1.X versions (see latest on central)

Maven

<dependency>
  <groupId>org.fxmisc.cssfx</groupId>
  <artifactId>cssfx</artifactId>
  <version>1.1.1</version>
</dependency>

Gradle

dependencies {
    compile "org.fxmisc.cssfx:cssfx:1.1.1"
}

Usages

Embedded

Starting monitoring CSS changes in development is as simple as adding one line in your application code.

CSSFX.start()

Doing so CSSFX will start to track every CSS resource that will be declared on any Scene or Parent in your application. This monitoring will be active for all the Stage that your application will use.

Mapping URIs to files on disk

CSSFX uses a functional interface URIToPathConverter (a function<String, Path> in fact) in order to be able to map CSS uris to file on the disk.

By providing several default implementations CSSFX is expected to run for you out of the box, without changes.

CSSFX comes with converters for:

  • Maven
  • Gradle
  • execution from jar file

By registering new converters, you can influence the way CSSFX resolves the files to monitor, see next paragraph for an example

If you think that CSSFX is missing some default converters, please post a new issue or create a pull request.

Converter example

Let's consider the following situation (sorry for the windows like path, you'll transform by yourself for other envs):

  • my app is packaged in c:/jars/myapp.jar
  • my sources are located in c:/projects/myapp/src/...

In order to support this setup, you could create your converter and use it in CSSFX

URIToPathConverter myConverter = new URIToPathConverter() {
    @Override
    public Path convert(String uri) {
        Matcher m = Pattern.compile("jar:file:/.*\\.jar!/(.*\\.css)").matcher(uri);
        if (m.matches()) {
            final String sourceFile = m.replaceFirst("c:/projects/myapp/src/$1").replace('/', '\\');
            return Paths.get(sourceFile);
        }
        return null;
    }
};

CSSFX.addConverter(myConverter).start();

Embedded with homemade configuration

If you need more control on how CSSFX will monitor your application & CSS changes, then you can use some extended functionalities of the CSSFX builder class.

There you will be able to:

  • add/reset converters
  • restrict monitoring on
    • one Stage
    • one Scene
    • one Node

As an external application

TODO

As a java agent

TODO

Logging in CSSFX

CSSFX comes with a mini logging framework.

CSSFX supports different properties to change default logging behavior

System Property Description
cssfx.log activates CSSFX logging
cssfx.log.level set the logging level to use, possible values NONE ERROR WARN INFO DEBUG, default is INFO
cssfx.log.type set the type of "appender" to use, possible values none console jul, default is console

You can also register your own LoggerFactory.

CSSFXLogger.setLoggerFactory((loggerName) -> (level, message, args) -> {
    System.out.println("I log by myself, original message: " + String.format(message, args));
});

Build & release

Normal build

  • mvnw clean install : UI tests are run headless
  • mvnw -P-ci clean install : UI tests are run visible on screen

Release

  • mvnw -Prelease,ci clean install: this will simulate a full build for oss delivery (javadoc, source attachement, GPG signature, ...)
  • git tag -a -s -m "release X.Y.Z, additionnal reason" X.Y.Z: tag the current HEAD with the given tag name. The tag is signed by the author of the release. Adapt with gpg key of maintainer.
    • Matthieu Brouillard command: git tag -a -s -u 2AB5F258 -m "release X.Y.Z, additional reason" X.Y.Z
    • Matthieu Brouillard public key
  • mvnw -Prelease,ci -DskipTests deploy
  • git push --follow-tags origin master

Credits

Many thanks to the JPro company which actively supports cssfx and promotes its usage.

Also, a big thank you to all contributors and people who reported issues or enhancement requests ; an OSS project is nothing without its users and community.

Special thanks to Tomas Mikula and his FXMisc project umbrella that have simplified the route of CSSFX to maven central prior to version 11.3.0.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].