v. 1.0.0
Took 1 hour 52 minutes
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
plugins {
|
plugins {
|
||||||
kotlin("multiplatform") version "1.5.30"
|
kotlin("multiplatform") version "1.5.31"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "0.4.29-SNAPSHOT"
|
version = "1.0.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@@ -46,6 +47,23 @@ kotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extra["PUBLISH_GROUP_ID"] = "nl.astraeus"
|
||||||
|
extra["PUBLISH_VERSION"] = "1.0.0"
|
||||||
|
extra["PUBLISH_ARTIFACT_ID"] = "kotlin-css-generator"
|
||||||
|
|
||||||
|
// Stub secrets to let the project sync and build without the publication values set up
|
||||||
|
val signingKeyId: String by project
|
||||||
|
val signingPassword: String by project
|
||||||
|
val signingSecretKeyRingFile: String by project
|
||||||
|
val ossrhUsername: String by project
|
||||||
|
val ossrhPassword: String by project
|
||||||
|
|
||||||
|
extra["signing.keyId"] = signingKeyId
|
||||||
|
extra["signing.password"] = signingPassword
|
||||||
|
extra["signing.secretKeyRingFile"] = signingSecretKeyRingFile
|
||||||
|
extra["ossrhUsername"] = ossrhUsername
|
||||||
|
extra["ossrhPassword"] = ossrhPassword
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
@@ -72,5 +90,49 @@ publishing {
|
|||||||
password = nexusPassword
|
password = nexusPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "sonatype"
|
||||||
|
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
credentials {
|
||||||
|
username = ossrhUsername
|
||||||
|
password = ossrhPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure all publications
|
||||||
|
publications.withType<MavenPublication> {
|
||||||
|
|
||||||
|
// Stub javadoc.jar artifact
|
||||||
|
//artifact(javadocJar.get())
|
||||||
|
|
||||||
|
// Provide artifacts information requited by Maven Central
|
||||||
|
pom {
|
||||||
|
name.set("kotlin-css-generator")
|
||||||
|
description.set("Kotlin css generator")
|
||||||
|
url.set("https://github.com/rnentjes/kotlin-css-generator")
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name.set("MIT")
|
||||||
|
url.set("https://opensource.org/licenses/MIT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id.set("rnentjes")
|
||||||
|
name.set("Rien Nentjes")
|
||||||
|
email.set("info@nentjes.com")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
url.set("https://github.com/rnentjes/kotlin-css-generator")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
sign(publishing.publications)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,3 +3,9 @@ kotlin.js.compiler=both
|
|||||||
|
|
||||||
nexusUsername=deployment
|
nexusUsername=deployment
|
||||||
nexusPassword=
|
nexusPassword=
|
||||||
|
|
||||||
|
signingKeyId=
|
||||||
|
signingPassword=
|
||||||
|
signingSecretKeyRingFile=
|
||||||
|
ossrhUsername=
|
||||||
|
ossrhPassword=
|
||||||
98
publish/build.gradle.kts
Normal file
98
publish/build.gradle.kts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import java.util.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
`maven-publish`
|
||||||
|
signing
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
project.extra.set("PUBLISH_GROUP_ID", "nl.astraeus")
|
||||||
|
project.extra.set("PUBLISH_VERSION", "1.0.0")
|
||||||
|
project.extra.set("PUBLISH_ARTIFACT_ID", "kotlin-css-generator")
|
||||||
|
|
||||||
|
apply(from = "${rootProject.projectDir}/build.gradle.kts")
|
||||||
|
|
||||||
|
// Stub secrets to let the project sync and build without the publication values set up
|
||||||
|
extra["signing.keyId"] = null
|
||||||
|
extra["signing.password"] = null
|
||||||
|
extra["signing.secretKeyRingFile"] = null
|
||||||
|
extra["ossrhUsername"] = null
|
||||||
|
extra["ossrhPassword"] = null
|
||||||
|
|
||||||
|
// Grabbing secrets from local.properties file or from environment variables, which could be used on CI
|
||||||
|
val secretPropsFile = project.rootProject.file("local.properties")
|
||||||
|
if (secretPropsFile.exists()) {
|
||||||
|
secretPropsFile.reader().use {
|
||||||
|
Properties().apply {
|
||||||
|
load(it)
|
||||||
|
}
|
||||||
|
}.onEach { (name, value) ->
|
||||||
|
extra[name.toString()] = value
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extra["signing.keyId"] = System.getenv("SIGNING_KEY_ID")
|
||||||
|
extra["signing.password"] = System.getenv("SIGNING_PASSWORD")
|
||||||
|
extra["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE")
|
||||||
|
extra["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
|
||||||
|
extra["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")
|
||||||
|
}
|
||||||
|
|
||||||
|
val javadocJar by tasks.registering(Jar::class) {
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getExtraString(name: String) = extra[name]?.toString()
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
// Configure maven central repository
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "sonatype"
|
||||||
|
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
credentials {
|
||||||
|
username = getExtraString("ossrhUsername")
|
||||||
|
password = getExtraString("ossrhPassword")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure all publications
|
||||||
|
publications.withType<MavenPublication> {
|
||||||
|
|
||||||
|
// Stub javadoc.jar artifact
|
||||||
|
artifact(javadocJar.get())
|
||||||
|
|
||||||
|
// Provide artifacts information requited by Maven Central
|
||||||
|
pom {
|
||||||
|
name.set("kotlin-css-generator")
|
||||||
|
description.set("Kotlin css generator")
|
||||||
|
url.set("https://github.com/rnentjes/kotlin-css-generator")
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name.set("MIT")
|
||||||
|
url.set("https://opensource.org/licenses/MIT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id.set("rnentjes")
|
||||||
|
name.set("Rien Nentjes")
|
||||||
|
email.set("info@nentjes.com")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
url.set("https://github.com/rnentjes/kotlin-css-generator")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signing artifacts. Signing.* extra properties values will be used
|
||||||
|
|
||||||
|
signing {
|
||||||
|
sign(publishing.publications)
|
||||||
|
}
|
||||||
121
publish/publish-mavencentral.gradle
Normal file
121
publish/publish-mavencentral.gradle
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
apply plugin: 'signing'
|
||||||
|
|
||||||
|
task publishSourcesJar(type: Jar) {
|
||||||
|
archiveClassifier.set('sources')
|
||||||
|
|
||||||
|
// For pure Kotlin libraries, in case you have them
|
||||||
|
from sourceSets.main.java.srcDirs
|
||||||
|
//from sourceSets.main.kotlin.srcDirs
|
||||||
|
}
|
||||||
|
|
||||||
|
task packageJavadoc(type: Jar) {
|
||||||
|
from javadoc
|
||||||
|
classifier = 'javadoc'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives publishSourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
File secretPropsFile = project.rootProject.file('local.properties')
|
||||||
|
|
||||||
|
ext["signing.keyId"] = ''
|
||||||
|
ext["signing.password"] = ''
|
||||||
|
ext["signing.secretKeyRingFile"] = ''
|
||||||
|
ext["ossrhUsername"] = ''
|
||||||
|
ext["ossrhPassword"] = ''
|
||||||
|
ext["sonatypeStagingProfileId"] = ''
|
||||||
|
|
||||||
|
if (secretPropsFile.exists()) {
|
||||||
|
Properties p = new Properties()
|
||||||
|
|
||||||
|
new FileInputStream(secretPropsFile).withCloseable { is ->
|
||||||
|
p.load(is)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.each { name, value ->
|
||||||
|
ext[name] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
release(MavenPublication) {
|
||||||
|
// The coordinates of the library, being set from variables that
|
||||||
|
// we'll set up later
|
||||||
|
groupId PUBLISH_GROUP_ID
|
||||||
|
artifactId PUBLISH_ARTIFACT_ID
|
||||||
|
version PUBLISH_VERSION
|
||||||
|
|
||||||
|
// Two artifacts, the `aar` (or `jar`) and the sources
|
||||||
|
if (project.plugins.findPlugin("com.android.library")) {
|
||||||
|
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
|
||||||
|
} else {
|
||||||
|
artifact("$buildDir/libs/${project.getName()}-${version}.jar")
|
||||||
|
}
|
||||||
|
artifact publishSourcesJar
|
||||||
|
artifact packageJavadoc
|
||||||
|
|
||||||
|
// Mostly self-explanatory metadata
|
||||||
|
pom {
|
||||||
|
name = PUBLISH_ARTIFACT_ID
|
||||||
|
description = 'Simple JDBC wrapper for query statistics'
|
||||||
|
url = 'https://github.com/rnentjes/Simple-jdbc-statistics'
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name = 'MIT License'
|
||||||
|
url = 'https://github.com/rnentjes/Simple-jdbc-statistics/blob/master/LICENCE.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id = 'rnentjes'
|
||||||
|
name = 'Rien Nentjes'
|
||||||
|
email = 'info@nentjes.com'
|
||||||
|
}
|
||||||
|
// Add all other devs here...
|
||||||
|
}
|
||||||
|
// Version control info - if you're using GitHub, follow the format as seen here
|
||||||
|
scm {
|
||||||
|
connection = 'scm:git:github.com/rnentjes/Simple-jdbc-statistics.git'
|
||||||
|
developerConnection = 'scm:git:ssh://github.com/rnentjes/Simple-jdbc-statistics.git'
|
||||||
|
url = 'https://github.com/rnentjes/Simple-jdbc-statistics.git/tree/main'
|
||||||
|
}
|
||||||
|
// A slightly hacky fix so that your POM will include any transitive dependencies
|
||||||
|
// that your library builds upon
|
||||||
|
/*
|
||||||
|
witXml {
|
||||||
|
def dependenciesNode = asNode().appendNode('dependencies')
|
||||||
|
|
||||||
|
project.configurations.implementation.allDependencies.each {
|
||||||
|
def dependencyNode = dependenciesNode.appendNode('dependency')
|
||||||
|
dependencyNode.appendNode('groupId', it.group)
|
||||||
|
dependencyNode.appendNode('artifactId', it.name)
|
||||||
|
dependencyNode.appendNode('version', it.version)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// The repository to publish to, Sonatype/MavenCentral
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
// This is an arbitrary name, you may also use "mavencentral" or
|
||||||
|
// any other name that's descriptive for you
|
||||||
|
name = "sonatype"
|
||||||
|
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||||
|
credentials {
|
||||||
|
username ossrhUsername
|
||||||
|
password ossrhPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
sign publishing.publications
|
||||||
|
}
|
||||||
12
publish/settings.gradle.kts
Normal file
12
publish/settings.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
maven { setUrl("https://plugins.gradle.org/m2/") }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "publish-kotlin-css-generator"
|
||||||
|
|
||||||
|
//enableFeaturePreview("GRADLE_METADATA")
|
||||||
|
//include(":publish")
|
||||||
44
readme.md
44
readme.md
@@ -1,7 +1,7 @@
|
|||||||
# Css generator like less/sass in kotlin multiplatform
|
# Css generator like less/sass in kotlin multiplatform
|
||||||
|
|
||||||
This library is for generating css from a kotlin dsl.
|
This library is for generating css from a kotlin dsl.
|
||||||
It is meant to be used runtime to dynamically generate css.
|
It can be used as an alternative to less/sass or as a runtime library to generate css on-the-fly.
|
||||||
|
|
||||||
Tools like less and sass are often used as a build step and take some time.
|
Tools like less and sass are often used as a build step and take some time.
|
||||||
This library is meant to be fast enough to generate the css on the fly either from the server or directly in the browser.
|
This library is meant to be fast enough to generate the css on the fly either from the server or directly in the browser.
|
||||||
@@ -31,6 +31,12 @@ Examples:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To generate the css call get generateCss function:
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val cssString: String = css.generateCss()
|
||||||
|
```
|
||||||
|
|
||||||
Result:
|
Result:
|
||||||
|
|
||||||
```css
|
```css
|
||||||
@@ -49,9 +55,22 @@ Result:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
There are several options when generating the css, for example minified:
|
||||||
|
|
||||||
|
|
||||||
|
```kotlin
|
||||||
|
val cssString: String = css.generateCss(minified = true)
|
||||||
|
```
|
||||||
|
|
||||||
|
Result:
|
||||||
|
|
||||||
|
```css
|
||||||
|
.button{padding:5px;}.buttona{color:hsla(0,50%,50%,1.0);background-color:white;}.buttona:hover{color:hsla(0,50%,55%,1.0);background-color:rgba(229,229,229,1.0);}
|
||||||
|
```
|
||||||
|
|
||||||
## Mixins
|
## Mixins
|
||||||
|
|
||||||
As it's just kotlin code includes, mixins etc. are just functions calls.
|
As it's all just kotlin code, includes and mixins etc. are just functions calls.
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
fun Style.borderStyles(borderWidth: Measurement = 2.px) {
|
fun Style.borderStyles(borderWidth: Measurement = 2.px) {
|
||||||
@@ -99,7 +118,26 @@ a {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Measurements
|
Giving the option combineEqualBlocks to the generateCss call will combine the a and .button blocks with the following result:
|
||||||
|
|
||||||
|
```css
|
||||||
|
a,
|
||||||
|
.button {
|
||||||
|
border-width: 2px;
|
||||||
|
border-color: aquamarine;
|
||||||
|
border-style: solid;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
border-width: 3px;
|
||||||
|
border-color: aquamarine;
|
||||||
|
border-style: solid;
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Measurements
|
||||||
|
|
||||||
Sizes and widths are given in measurements, there are extension variables to help with these:
|
Sizes and widths are given in measurements, there are extension variables to help with these:
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,5 @@
|
|||||||
package nl.astraeus.css.properties
|
package nl.astraeus.css.properties
|
||||||
|
|
||||||
class BorderRadius(
|
|
||||||
value: String
|
|
||||||
) : CssProperty(value) {
|
|
||||||
companion object {
|
|
||||||
fun px(nr: Int) = BorderRadius("${nr}px")
|
|
||||||
fun em(nr: Int) = BorderRadius("${nr}em")
|
|
||||||
fun em(nr: Double) = BorderRadius("${nr}em")
|
|
||||||
fun perc(nr: Int) = BorderRadius("${nr}%")
|
|
||||||
fun perc(nr: Double) = BorderRadius("${nr}%")
|
|
||||||
fun pc(nr: Int) = BorderRadius("${nr}pc")
|
|
||||||
fun pc(nr: Double) = BorderRadius("${nr}pc")
|
|
||||||
fun cm(nr: Int) = BorderRadius("${nr}cm")
|
|
||||||
fun cm(nr: Double) = BorderRadius("${nr}cm")
|
|
||||||
val initial = BorderRadius("initial")
|
|
||||||
val inherit = BorderRadius("inherit")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class BorderStyle(
|
class BorderStyle(
|
||||||
value: String
|
value: String
|
||||||
) : CssProperty(value) {
|
) : CssProperty(value) {
|
||||||
|
|||||||
@@ -645,18 +645,10 @@ open class Style : CssGenerator() {
|
|||||||
props["border-bottom-left-radius"] = prp(*radius)
|
props["border-bottom-left-radius"] = prp(*radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun borderBottomLeftRadius(vararg radius: BorderRadius) {
|
|
||||||
props["border-bottom-left-radius"] = prp(*radius)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun borderBottomRightRadius(vararg radius: Measurement) {
|
fun borderBottomRightRadius(vararg radius: Measurement) {
|
||||||
props["border-bottom-right-radius"] = prp(*radius)
|
props["border-bottom-right-radius"] = prp(*radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun borderBottomRightRadius(vararg radius: BorderRadius) {
|
|
||||||
props["border-bottom-right-radius"] = prp(*radius)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun borderBottomStyle(style: BorderStyle) {
|
fun borderBottomStyle(style: BorderStyle) {
|
||||||
props["border-bottom-style"] = prp(style)
|
props["border-bottom-style"] = prp(style)
|
||||||
}
|
}
|
||||||
@@ -795,18 +787,10 @@ open class Style : CssGenerator() {
|
|||||||
props["border-top-left-radius"] = prp(radius)
|
props["border-top-left-radius"] = prp(radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun borderTopLeftRadius(radius: BorderRadius) {
|
|
||||||
props["border-top-left-radius"] = prp(radius)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun borderTopRightRadius(radius: Measurement) {
|
fun borderTopRightRadius(radius: Measurement) {
|
||||||
props["border-top-right-radius"] = prp(radius)
|
props["border-top-right-radius"] = prp(radius)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun borderTopRightRadius(radius: BorderRadius) {
|
|
||||||
props["border-top-right-radius"] = prp(radius)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun borderTopStyle(style: BorderStyle) {
|
fun borderTopStyle(style: BorderStyle) {
|
||||||
props["border-top-style"] = prp(style)
|
props["border-top-style"] = prp(style)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class Examples {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
println(css.generateCss())
|
println(css.generateCss(minified = true))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -62,9 +62,8 @@ class Examples {
|
|||||||
println(css.generateCss())
|
println(css.generateCss())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testMeasurementss() {
|
fun testMeasurements() {
|
||||||
val css = style {
|
val css = style {
|
||||||
select("body") {
|
select("body") {
|
||||||
fontSize(1.2.em)
|
fontSize(1.2.em)
|
||||||
@@ -75,4 +74,58 @@ class Examples {
|
|||||||
|
|
||||||
println(css.generateCss())
|
println(css.generateCss())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testGeneration() {
|
||||||
|
val color = hsla(0, 50, 50, 1.0)
|
||||||
|
val backgroundColor = Color.white
|
||||||
|
|
||||||
|
val css = style {
|
||||||
|
select(cls("button")) {
|
||||||
|
padding(5.px)
|
||||||
|
|
||||||
|
select("a", "span") {
|
||||||
|
color(color)
|
||||||
|
backgroundColor(backgroundColor)
|
||||||
|
|
||||||
|
hover {
|
||||||
|
color(color.lighten(10))
|
||||||
|
backgroundColor(backgroundColor.darken(10))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
println(css.generateCss(
|
||||||
|
minified = false,
|
||||||
|
sortProperties = true,
|
||||||
|
combineEqualBlocks = false
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testMediaQueries() {
|
||||||
|
val css = style {
|
||||||
|
media("screen and (min-width: 30em)") {
|
||||||
|
select("html", "body") {
|
||||||
|
backgroundColor(Color.purple)
|
||||||
|
color(Color.blue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
media("print") {
|
||||||
|
select("html", "body") {
|
||||||
|
backgroundColor(Color.white)
|
||||||
|
color(Color.darkGrey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
println(css.generateCss(
|
||||||
|
minified = false,
|
||||||
|
sortProperties = true,
|
||||||
|
combineEqualBlocks = true
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user