Skip to content

Commit 185ae68

Browse files
committed
Prepared for release
1 parent b4ee0fd commit 185ae68

File tree

3 files changed

+47
-42
lines changed

3 files changed

+47
-42
lines changed

README.md

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
[![javadoc](https://javadoc.io/badge2/com.helger/ph-css/javadoc.svg)](https://javadoc.io/doc/com.helger/ph-css)
55
[![CodeCov](https://codecov.io/gh/phax/ph-css/branch/master/graph/badge.svg)](https://codecov.io/gh/phax/ph-css)
66

7-
Java CSS 2 and CSS 3 parser and builder. This version supersedes phloc-css.
8-
The Maven plugin to compress CSS files at build time is located in sub-project ph-csscompress-maven-plugin and described further down.
7+
Java-based CSS 3 parser and builder.
8+
The Maven plugin to compress CSS files at build time is located in sub-module `ph-csscompress-maven-plugin` and described further down.
99

10-
ph-css has no logic for applying CSS onto HTML elements. This page shows some basic code examples that can be used to use the library. All snippets are free for any use.
10+
`ph-css` has no logic for applying CSS onto HTML elements. This page shows some basic code examples that can be used to use the library. All snippets are free for any use.
1111

12-
ph-css and ph-csscompress-maven-plugin are both licensed under the **Apache 2.0 license**.
12+
`ph-css` and `ph-csscompress-maven-plugin` are both licensed under the **Apache 2.0 license**.
1313

14-
ph-css is used as a part of [Apache JMeter 3](https://github.com/apache/jmeter) :)
14+
`ph-css` is used as a part of [Apache JMeter 3](https://github.com/apache/jmeter) :)
1515

1616
# Maven usage
1717

@@ -25,7 +25,7 @@ Add the following to your pom.xml to use this artifact, replacing `x.y.z` with t
2525
</dependency>
2626
```
2727

28-
To build ph-css from source, Maven 3.0.4 is required. Any Maven version below does **NOT** work!
28+
To build `ph-css` from source, Maven 3.x is required. Any Maven version below does **NOT** work!
2929

3030
# Documentation
3131

@@ -39,16 +39,17 @@ Please look at my personal [Coding Styleguide](https://github.com/phax/meta/blob
3939

4040
A complete stylesheet is represented as an instance of `com.helger.css.decl.CascadingStyleSheet`. There is no difference between CSS 2.1 and CSS 3.0 instances. The class `com.helger.css.decl.CascadingStyleSheet` contains all top-level rules that may be present in a CSS:
4141

42-
* Import rules (`@import`) - `com.helger.css.decl.CSSImportRule`
43-
* Namespace rules (`@namespace`) - `com.helger.css.decl.CSSNamespaceRule`
44-
* Style rules (e.g. `div{color:red;}`) - `com.helger.css.decl.CSSStyleRule`
45-
* Page rules (`@page`) - `com.helger.css.decl.CSSPageRule`
46-
* Media rules (`@media`) - `com.helger.css.decl.CSSMediaRule`
47-
* Font face rules (`@font-face`) - `com.helger.css.decl.CSSFontFaceRule`
48-
* Keyframes rules (`@keyframes`) - `com.helger.css.decl.CSSKeyframesRule`
49-
* Viewport rules (`@viewport`) - `com.helger.css.decl.CSSViewportRule`
50-
* Supports rules (`@supports`) - `com.helger.css.decl.CSSSupportsRule`
51-
* Any other unknown rules (`@foo`) - `com.helger.css.decl.CSSUnknownRule`
42+
* Import rules (`@import`) - `com.helger.css.decl.CSSImportRule`
43+
* Namespace rules (`@namespace`) - `com.helger.css.decl.CSSNamespaceRule`
44+
* Style rules (e.g. `div{color:red;}`) - `com.helger.css.decl.CSSStyleRule`
45+
* Page rules (`@page`) - `com.helger.css.decl.CSSPageRule`
46+
* Media rules (`@media`) - `com.helger.css.decl.CSSMediaRule`
47+
* Font face rules (`@font-face`) - `com.helger.css.decl.CSSFontFaceRule`
48+
* Keyframes rules (`@keyframes`) - `com.helger.css.decl.CSSKeyframesRule`
49+
* Viewport rules (`@viewport`) - `com.helger.css.decl.CSSViewportRule`
50+
* Supports rules (`@supports`) - `com.helger.css.decl.CSSSupportsRule`
51+
* Layer rules (`@layer`) - `com.helger.css.decl.CSSLayerRule`
52+
* Any other unknown rules (`@foo`) - `com.helger.css.decl.CSSUnknownRule`
5253

5354
## CSS reading
5455

@@ -66,10 +67,10 @@ Since v3.8.2 the class `com.helger.css.reader.CSSReaderSettings` is present and
6667
### Recoverable Errors
6768
ph-css differentiates between recoverable errors and unrecoverable errors. An example for a recoverable error is e.g. an `@import` rule in the wrong place or a missing closing bracket within a style declaration. For recoverable errors a special handler interface `com.helger.css.reader.errorhandler.ICSSParseErrorHandler` is present. You can pass an implementation of this error handler to the CSS reader (see above). The following implementations are present by default (all residing in package `com.helger.css.reader.errorhandler`):
6869

69-
* `DoNothingCSSParseErrorHandler` - silently ignoring all recoverable errors
70-
* `LoggingCSSParseErrorHandler` - logging all recoverable errors to an SLF4J logger
71-
* `ThrowingCSSParseErrorHandler` - throws a `com.helger.css.parser.ParseException` in case of a recoverable error which is afterwards handled by the unrecoverable error handler (see below). This can be used to enforce handling only 100% valid CSS files. This is the default setting, if no error handler is specified during reading.
72-
* `CollectingCSSParseErrorHandler` - collects all recoverable errors into a list of `com.helger.css.reader.errorhandler.CSSParseError` instances for later evaluation.
70+
* `DoNothingCSSParseErrorHandler` - silently ignoring all recoverable errors
71+
* `LoggingCSSParseErrorHandler` - logging all recoverable errors to an SLF4J logger
72+
* `ThrowingCSSParseErrorHandler` - throws a `com.helger.css.parser.ParseException` in case of a recoverable error which is afterwards handled by the unrecoverable error handler (see below). This can be used to enforce handling only 100% valid CSS files. This is the default setting, if no error handler is specified during reading.
73+
* `CollectingCSSParseErrorHandler` - collects all recoverable errors into a list of `com.helger.css.reader.errorhandler.CSSParseError` instances for later evaluation.
7374

7475
Some error handlers can be nested so that a combination of a logging handler and a collecting handler can easily be achieved like:
7576

@@ -85,8 +86,8 @@ Both `CSSReader` and `CSSReaderDeclarationList` have the possibility to define a
8586

8687
In case of an unrecoverable error, the underlying parser engine of JavaCC throws a `com.helger.css.parser.ParseException`. This exception contains all the necessary information on where the error occurred. In case of such an unrecoverable error, the result of the reading will always be `null` and the exception is not automatically propagated to the caller. To explicitly get notified when such a parse error occurs, the handler interface `com.helger.css.handler.ICSSParseExceptionCallback` is available. The available implementations are (all residing in package `com.helger.css.handler`):
8788

88-
* `DoNothingCSSParseExceptionHandler` - silently ignore all unrecoverable errors
89-
* `LoggingCSSParseExceptionHandler` - log all unrecoverable errors to an SLF4J logger
89+
* `DoNothingCSSParseExceptionHandler` - silently ignore all unrecoverable errors
90+
* `LoggingCSSParseExceptionHandler` - log all unrecoverable errors to an SLF4J logger
9091

9192
As there is at most one unrecoverable error per parse there is no collecting implementation of an `ICSSParseExceptionCallback` available. If it is desired to propagate the Exception to the caller you need to implement your own `ICSSParseExceptionCallback` subclass that throws an unchecked exception (one derived from `RuntimeException`). Example:
9293

@@ -146,7 +147,7 @@ All of these shorthand properties are registered in class `CSSShortHandRegistry`
146147

147148
```java
148149
// Parse a dummy declaration
149-
final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border:1px dashed", ECSSVersion.CSS30).getDeclarationAtIndex (0);
150+
final CSSDeclaration aDecl = CSSReaderDeclarationList.readFromString ("border:1px dashed").getDeclarationAtIndex (0);
150151

151152
// Get the Shorthand descriptor for "border"
152153
final CSSShortHandDescriptor aSHD = CSSShortHandRegistry.getShortHandDescriptor (ECSSProperty.BORDER);
@@ -157,21 +158,21 @@ All of these shorthand properties are registered in class `CSSShortHandRegistry`
157158

158159
In the above example, `aSplittedDecls` will contain 3 elements with the following content:
159160

160-
* `border-width:1px`
161-
* `border-style:dashed`
162-
* `border-color:black`
161+
* `border-width:1px`
162+
* `border-style:dashed`
163+
* `border-color:black`
163164

164165
Even though no color value was provided, the default value `black` is returned. For all "sub-declarations", sensible default values are defined.
165166

166167
## CSS utilities
167168

168169
ph-css contains a multitude of small utility class covering different aspects of CSS
169-
* `com.helger.css.utils.CSSColorHelper` contains methods to read and write the different types of CSS color values (rgb, rgba, hsl, hsla and hex value)
170-
* `com.helger.css.utils.ECSSColor` contains the basic CSS colors as an enumeration
171-
* `com.helger.css.ECSSUnit` contains all the default CSS units (like. `px` or `em`)
172-
* `com.helger.css.utils.CSSNumberHelper` contains methods for handling the combination of numeric values and units.
173-
* `com.helger.css.utils.CSSRectHelper` contains methods for handling CSS `rect` values.
174-
* `com.helger.css.tools.MediaQueryTools` provides shortcut methods for wrapping a complete `CascadingStyleSheet` in one or more media queries
170+
* `com.helger.css.utils.CSSColorHelper` contains methods to read and write the different types of CSS color values (rgb, rgba, hsl, hsla and hex value)
171+
* `com.helger.css.utils.ECSSColor` contains the basic CSS colors as an enumeration
172+
* `com.helger.css.ECSSUnit` contains all the default CSS units (like. `px` or `em`)
173+
* `com.helger.css.utils.CSSNumberHelper` contains methods for handling the combination of numeric values and units.
174+
* `com.helger.css.utils.CSSRectHelper` contains methods for handling CSS `rect` values.
175+
* `com.helger.css.tools.MediaQueryTools` provides shortcut methods for wrapping a complete `CascadingStyleSheet` in one or more media queries
175176

176177
# Code Examples
177178

@@ -221,7 +222,7 @@ The following list gives an overview of known shortcomings in ph-css
221222

222223
A Maven plugin to compress CSS files at build time using ph-css.
223224

224-
It requires Java 11 and Maven 3 to run.
225+
It requires Java 17 and Maven 3.x to run.
225226

226227
## Maven configuration
227228

@@ -314,10 +315,11 @@ Configuration items are:
314315

315316
## News and noteworthy
316317

317-
v8.0.0 - work in progress
318+
v8.0.0 - 2025-08-25
318319
* Requires Java 17 as the minimum version
319320
* Updated to ph-commons 12.0.0
320321
* Removed all deprecated methods marked for removal
322+
* Removed the separation between CSS2 and CSS3 - all one now
321323
* Removed class `ECSSVersion` and interface `ICSSVersionAware` because they have no real role anymore
322324

323325
v7.1.0 - 2025-08-20

ph-css/pom.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@
167167
</instructions>
168168
</configuration>
169169
</plugin>
170-
<plugin>
171-
<groupId>org.apache.maven.plugins</groupId>
172-
<artifactId>maven-javadoc-plugin</artifactId>
173-
<configuration>
174-
<doclint>none</doclint>
175-
</configuration>
176-
</plugin>
177170
<plugin>
178171
<groupId>com.mycila</groupId>
179172
<artifactId>license-maven-plugin</artifactId>
@@ -190,6 +183,16 @@
190183
</licenseSets>
191184
</configuration>
192185
</plugin>
186+
<plugin>
187+
<groupId>org.apache.maven.plugins</groupId>
188+
<artifactId>maven-javadoc-plugin</artifactId>
189+
<configuration>
190+
<source>17</source>
191+
<sourcepath>
192+
${project.build.sourceDirectory}:${project.build.directory}/generated-sources/jjtree:${project.build.directory}/generated-sources/javacc
193+
</sourcepath>
194+
</configuration>
195+
</plugin>
193196
</plugins>
194197
</build>
195198
</project>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<dependency>
6767
<groupId>com.helger.commons</groupId>
6868
<artifactId>ph-commons-parent-pom</artifactId>
69-
<version>12.0.0-SNAPSHOT</version>
69+
<version>12.0.0</version>
7070
<type>pom</type>
7171
<scope>import</scope>
7272
</dependency>

0 commit comments

Comments
 (0)