File tree Expand file tree Collapse file tree 6 files changed +36
-0
lines changed
java/io/miret/etienne/gradle/sass
resources/io/miret/etienne/gradle/sass
main/java/io/miret/etienne/gradle/sass Expand file tree Collapse file tree 6 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ compileSass {
7171 // (Default is to not to watch, compile once and terminate)
7272 watch ()
7373
74+ // Prevent sass to emit warnings
75+ // (Default is to emit them)
76+ quiet ()
77+
7478 // Source map style:
7579 // - file: output source map in a separate file (default)
7680 // - embed: embed source map in CSS
Original file line number Diff line number Diff line change @@ -290,6 +290,22 @@ void should_create_file_source_map_with_relative_urls () throws IOException {
290290 ));
291291 }
292292
293+ @ Test
294+ void should_be_quiet () throws IOException {
295+ Path out = createExecutable ();
296+
297+ GradleRunner .create ()
298+ .withPluginClasspath ()
299+ .withArguments ("quiet" )
300+ .withProjectDir (projectDir .toFile ())
301+ .build ();
302+
303+ assertThat (out ).hasContent (String .format (
304+ "sass --style=expanded --quiet --source-map-urls=relative %1$s/src/main/sass:%1$s/build/sass" ,
305+ projectDir .toRealPath ()
306+ ));
307+ }
308+
293309 private Path createExecutable () throws IOException {
294310 Path out = projectDir .resolve ("build/out" );
295311 Path sassDir = projectDir .resolve (".gradle/sass/some.specific.version/dart-sass" );
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ task watch (type: CompileSass) {
2424 watch ()
2525}
2626
27+ task quiet (type : CompileSass ) {
28+ quiet ()
29+ }
30+
2731task compileNoCharset (type : CompileSass ) {
2832 noCharset ()
2933}
Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ enum SourceMapUrls {
6262 @ Getter (onMethod_ = {@ Input })
6363 private boolean errorCss = true ;
6464
65+ @ Getter (onMethod_ = {@ Input })
66+ private boolean quiet = false ;
67+
6568 @ Setter
6669 @ Getter (onMethod_ = {@ Input })
6770 private SourceMap sourceMap = SourceMap .file ;
@@ -111,6 +114,10 @@ public void watch () {
111114 watch = true ;
112115 }
113116
117+ public void quiet () {
118+ quiet = true ;
119+ }
120+
114121 @ Internal
115122 public Style getExpanded () {
116123 return Style .expanded ;
@@ -168,6 +175,7 @@ public void compileSass () {
168175 compileSassWorkParameters .getWatch ().set (watch );
169176 compileSassWorkParameters .getCharset ().set (charset );
170177 compileSassWorkParameters .getErrorCss ().set (errorCss );
178+ compileSassWorkParameters .getQuiet ().set (quiet );
171179 });
172180 }
173181
Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ public void execute() {
3838 if (!parameters .getErrorCss ().get ()) {
3939 args .add ("--no-error-css" );
4040 }
41+ if (parameters .getQuiet ().get ()) {
42+ args .add ("--quiet" );
43+ }
4144 CompileSass .SourceMap sourceMap = parameters .getSourceMap ().get ();
4245 switch (sourceMap ) {
4346 case none :
Original file line number Diff line number Diff line change @@ -19,4 +19,5 @@ public interface CompileSassWorkParameters extends WorkParameters {
1919 Property <Boolean > getWatch ();
2020 Property <Boolean > getCharset ();
2121 Property <Boolean > getErrorCss ();
22+ Property <Boolean > getQuiet ();
2223}
You can’t perform that action at this time.
0 commit comments