Multiple theme names

Post Reply
s4p
Posts: 4
Joined: 28 Jan 2019, 19:16

21 Mar 2019, 18:59

Hi,

I bought the Primefaces Designer and like to create multiple themes. Basically they are all the same but with different colors in their variables.scss file.

My current approach is the following:

assemble:
  • abcd.xml
  • efgh.xml
  • ...
resources:
  • primefaces-abcd
  • primefaces-efgh
  • ...
My abcd.xml has the following content:

Code: Select all

        <fileSet>
            <directory>${basedir}/src/main/webapp/resources/primefaces-abcd</directory>
            <outputDirectory>/META-INF/resources/primefaces-abcd</outputDirectory>
        </fileSet>
I moved the files in the resources folder like this:

common:
  • _fonts.scss
  • _my-icons.scss
  • _login.scss
  • ...
fonts:
  • open-sans-v13-latin-regular.eot
  • open-sans-v13-latin-regular.svg
  • ...
primefaces-abcd
  • _variables.scss
  • theme.scss
primefaces-efgh
  • _variables.scss
  • theme.scss
the theme.scss looks like this:

Code: Select all

@import './variables';
@import '../common/_fonts';
@import '../common/_login';
@import '../common/_my-icons';
@import '../designer/_core';
the fonts.scss I changed like this:

Code: Select all

/* open-sans-regular - latin */
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  src: url("\#{resource['fonts/open-sans-v13-latin-regular.eot']}"); /* IE9 Compat Modes */
  src: local('Open Sans'), local('OpenSans'),
       url("\#{resource['fonts/open-sans-v13-latin-regular.eot']}#iefix") format('embedded-opentype'), /* IE6-IE8 */
       url("\#{resource['fonts/open-sans-v13-latin-regular.woff2']}") format('woff2'), /* Super Modern Browsers */
       url("\#{resource['fonts/open-sans-v13-latin-regular.woff']}") format('woff'), /* Modern Browsers */
       url("\#{resource['fonts/open-sans-v13-latin-regular.ttf']}") format('truetype'), /* Safari, Android, iOS */
       url("\#{resource['fonts/open-sans-v13-latin-regular.svg']}#OpenSans") format('svg'); /* Legacy iOS */
}


/* open-sans-regular - latin */
@font-face {
  font-family: 'my-font';
  font-style: normal;
  src: url("\#{resource['fonts/my-font.ttf']}"); /* IE9 Compat Modes */
  src: local('SAP-icons'), local('my-font'),
       url("\#{resource['fonts/my-font.woff2']}") format('woff2'), /* Super Modern Browsers */
       url("\#{resource['fonts/my-font.woff']}") format('woff'), /* Modern Browsers */
       url("\#{resource['fonts/my-font.ttf']}") format('truetype'), /* Safari, Android, iOS */
       url("\#{resource['fonts/my-font.svg']}#my-font") format('svg'); /* Legacy iOS */
}
As you can see I removed the theme information as I don't like to copy the font files into each folder. When I start the designer I can set the theme to abcd or efgh and it works perfect.

But how do I build the project and use it somewhere else? The pom.xml must be changed and I don't know how?

Best regards
Michael

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

17 Apr 2019, 14:35

Sorry for the delayed response. Please examine pom.xml;

Code: Select all

<profiles>
        <profile>
            <id>build</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.3</version>
                        <executions>
                            <execution>
                                <id>build-theme</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/assemble/theme.xml</descriptor>
                                    </descriptors>
                                    <finalName>primefaces-mytheme-${project.version}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
- abcd.xml instead of theme.xml in <descriptor>
- please change <finalName>primefaces-mytheme-${project.version}</finalName>

Post Reply

Return to “PrimeFaces Theme Designer API”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 0 guests