[ECOMMERCE-418] Convert VAADIN/ecommerce/styles.css to scss file Created: 10/Jun/21  Updated: 18/Jul/21  Resolved: 18/Jun/21

Status: Closed
Project: E-commerce
Component/s: None
Affects Version/s: 1.3
Fix Version/s: 1.3

Type: Improvement Priority: Neutral
Reporter: Quach Hao Thien Assignee: Quach Hao Thien
Resolution: Fixed Votes: 0
Labels: VN-Implementation, VN-Testing
Remaining Estimate: 0d
Time Spent: 1d 7.5h
Original Estimate: Not Specified

Attachments: PNG File image-2021-06-10-13-35-55-936.png    
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Epic Link: New Product Chooser 1.3
Sprint: Content Mngmt 6
Story Points: 3

 Description   

To prevent the complexity of styling in css in the future

 DEV Note:

  1. Define scss file replace for current css
  2. Add maven plugin to build scss -> css, the css file will be placed in target
  3. Using @Stylesheet to include the new built css

maven plugin:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>groovy-maven-plugin</artifactId>
  <executions>
    <execution>
      <phase>process-resources</phase>
      <goals>
        <goal>execute</goal>
      </goals>
      <configuration>
        <source>
          import com.vaadin.sass.SassCompiler
          import java.util.regex.Matcher

          new File("${project.basedir}").eachFileRecurse {
          if (it.path =~ /\/target\/.*(\/VAADIN\/.*)(\/.*)\.scss$/) {
          def sassFile = it.path
          def cssPath = "${project.basedir}/target/classes"+Matcher.lastMatcher[0][1]
          def cssFile = cssPath + Matcher.lastMatcher[0][2]+".css"
          println "Compiling Sass file " + sassFile + " -&gt; " + cssFile
          new File(cssPath).mkdirs();
          SassCompiler.main([sassFile, cssFile] as String[])
          }
          }
        </source>
      </configuration>
    </execution>
  </executions>
</plugin>

Generated at Mon Feb 12 01:43:53 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.