[Gradle, JS] Disable css support by default
#KT-39654 fixed
This commit is contained in:
+2
-2
@@ -158,7 +158,7 @@ constructor(
|
|||||||
var sourceMaps: Boolean = true
|
var sourceMaps: Boolean = true
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
val cssSettings: KotlinWebpackCssSettings = KotlinWebpackCssSettings()
|
val cssSupport: KotlinWebpackCssSupport = KotlinWebpackCssSupport()
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
@Optional
|
@Optional
|
||||||
@@ -187,7 +187,7 @@ constructor(
|
|||||||
outputFileName = outputFileName,
|
outputFileName = outputFileName,
|
||||||
configDirectory = configDirectory,
|
configDirectory = configDirectory,
|
||||||
bundleAnalyzerReportDir = if (report) reportDir else null,
|
bundleAnalyzerReportDir = if (report) reportDir else null,
|
||||||
cssSettings = cssSettings,
|
cssSupport = cssSupport,
|
||||||
devServer = devServer,
|
devServer = devServer,
|
||||||
devtool = devtool,
|
devtool = devtool,
|
||||||
sourceMaps = sourceMaps,
|
sourceMaps = sourceMaps,
|
||||||
|
|||||||
+5
-5
@@ -30,7 +30,7 @@ data class KotlinWebpackConfig(
|
|||||||
val bundleAnalyzerReportDir: File? = null,
|
val bundleAnalyzerReportDir: File? = null,
|
||||||
val reportEvaluatedConfigFile: File? = null,
|
val reportEvaluatedConfigFile: File? = null,
|
||||||
val devServer: DevServer? = null,
|
val devServer: DevServer? = null,
|
||||||
val cssSettings: KotlinWebpackCssSettings = KotlinWebpackCssSettings(),
|
val cssSupport: KotlinWebpackCssSupport = KotlinWebpackCssSupport(),
|
||||||
val devtool: String? = WebpackDevtool.EVAL_SOURCE_MAP,
|
val devtool: String? = WebpackDevtool.EVAL_SOURCE_MAP,
|
||||||
val showProgress: Boolean = false,
|
val showProgress: Boolean = false,
|
||||||
val sourceMaps: Boolean = false,
|
val sourceMaps: Boolean = false,
|
||||||
@@ -57,10 +57,10 @@ data class KotlinWebpackConfig(
|
|||||||
it.add(versions.webpackDevServer)
|
it.add(versions.webpackDevServer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cssSettings.enabled || cssSettings.rules.isEmpty()) return@also
|
if (!cssSupport.enabled || cssSupport.rules.isEmpty()) return@also
|
||||||
|
|
||||||
it.add(versions.cssLoader)
|
it.add(versions.cssLoader)
|
||||||
cssSettings.rules.forEach { rule ->
|
cssSupport.rules.forEach { rule ->
|
||||||
when (rule.mode) {
|
when (rule.mode) {
|
||||||
EXTRACT -> it.add(versions.miniCssExtractPlugin)
|
EXTRACT -> it.add(versions.miniCssExtractPlugin)
|
||||||
INLINE -> it.add(versions.styleLoader)
|
INLINE -> it.add(versions.styleLoader)
|
||||||
@@ -260,7 +260,7 @@ data class KotlinWebpackConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun Appendable.appendCssSettings() {
|
private fun Appendable.appendCssSettings() {
|
||||||
if (!cssSettings.enabled || cssSettings.rules.isEmpty())
|
if (!cssSupport.enabled || cssSupport.rules.isEmpty())
|
||||||
return
|
return
|
||||||
|
|
||||||
appendln(
|
appendln(
|
||||||
@@ -298,7 +298,7 @@ data class KotlinWebpackConfig(
|
|||||||
|
|
|
|
||||||
""".trimMargin()
|
""".trimMargin()
|
||||||
|
|
||||||
cssSettings.rules.forEach { rule ->
|
cssSupport.rules.forEach { rule ->
|
||||||
appendln(
|
appendln(
|
||||||
"""
|
"""
|
||||||
| ;(function(config) {
|
| ;(function(config) {
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@ import org.gradle.api.tasks.Internal
|
|||||||
import org.gradle.api.tasks.Nested
|
import org.gradle.api.tasks.Nested
|
||||||
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackCssMode.INLINE
|
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackCssMode.INLINE
|
||||||
|
|
||||||
data class KotlinWebpackCssSettings(
|
data class KotlinWebpackCssSupport(
|
||||||
@Input
|
@Input
|
||||||
var enabled: Boolean = true,
|
var enabled: Boolean = false,
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
var rules: MutableList<KotlinWebpackCssRule> = mutableListOf(
|
var rules: MutableList<KotlinWebpackCssRule> = mutableListOf(
|
||||||
Reference in New Issue
Block a user