One artifact per theme #6

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@aheritier

This pull request add the generation of one webjar artifact per theme with all bootstrap resources correctly organized. It should solve issue #2
Just use something like this in your project

<script type="text/javascript" src="webjars/bootswatch-spacelab/3.0.3+1/js/bootstrap.min.js"></script>
Arnaud Héri... added some commits Jan 10, 2014
Arnaud Héritier We continue to generate the bootswatch webjar with everything in it a…
…nd we add one web jar per theme containing all bootstrap resources + theme files
8f51ebe
Arnaud Héritier ignore target dirs c7622f4
@aheritier

The Pull Request #6 is solving the issue #2 for me.
I used a maven version 3.0.3_2-SNAPSHOT even if the upstream version is 3.0.3+1
@jamesward Could you review/merge/release it please (fill free to change the webjar version to something else)

@jamesward jamesward commented on the diff Jan 11, 2014
amelia/pom.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>bootswatch</artifactId>
+ <groupId>org.webjars</groupId>
+ <version>3.0.3_2-SNAPSHOT</version>
@jamesward
jamesward Jan 11, 2014 Member

I think we can use a variable like ${parent.version} so that we don't need to manually change all of these for a release.

@aheritier
aheritier Jan 14, 2014

No you cannot use properties in GAV :( That's an annoying restriction of Maven to have to duplicate the verion in all POMs. You have to use the versions or release plugins to update them

@jamesward jamesward commented on the diff Jan 11, 2014
<artifactId>oss-parent</artifactId>
+ <groupId>org.sonatype.oss</groupId>
@jamesward
jamesward Jan 11, 2014 Member

To keep this PR clean can you undo the rearrangements like this one?

@aheritier
aheritier Jan 13, 2014

Yes, My fault. I will repropose it without such changes. I used the "mvn com.google.code.sortpom:maven-sortpom-plugin:sort" to cleanup my new POMs and forgot to reset useless changes in the master one.

@jamesward jamesward commented on the diff Jan 11, 2014
<version>7</version>
</parent>
<groupId>org.webjars</groupId>
<artifactId>bootswatch</artifactId>
- <version>3.0.4+1-SNAPSHOT</version>
+ <version>3.0.3_2-SNAPSHOT</version>
+ <packaging>pom</packaging>
@jamesward
jamesward Jan 11, 2014 Member

Don't we still need a jar for the bootswatch WebJar? Maybe it just includes the bootstrap.min.css from boostwatch.

@aheritier
aheritier Jan 13, 2014

I had to convert the main pom from jar to pom packaging to use modules and thus I manually rebuilt/attached the jar as it was built before manually with the jar and buildhelper plugins

@jamesward
jamesward Jan 13, 2014 Member

I see. Maybe instead we can have a module that produces it instead. And the root pom should have an artifactId of bootswatch-parent.

@aheritier
aheritier Jan 13, 2014

yes it is possible. No problem for that. I used the other to don't add one more module but with another child it will be more readable and simpler to maintain I think.

@jamesward jamesward commented on the diff Jan 11, 2014
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.3.2</version>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>copy-theme-archive</id>
+ <configuration>
+ <target>
+ <echo message="adding bootstrap distribution resources"></echo>
@jamesward
jamesward Jan 11, 2014 Member

We actually need to avoid putting bootstrap and the other deps from bower_components inside this WebJar. Instead they should be pulled in via their own WebJars.

@aheritier
aheritier Jan 13, 2014

I understand this and need your advices.
The existing bootswatch webjar is directly bundling all the git repository archive provided from a given tag (http://www.webjars.org/listfiles/bootswatch/3.0.3+1).
It is including all themes CSS (and LESS) files (ex: https://github.com/thomaspark/bootswatch/tree/v3.0.3%2B1/spacelab) and various bower dependencies like bootstrap, fontawesome ... (https://github.com/thomaspark/bootswatch/tree/v3.0.3%2B1/bower_components)
But there aren't really usable because the provided CSS are supposed to replace the ones inside a bootstrap distribution. For example, in CSS you'll find relative paths to ../fonts/ to access to bootstrap icons while they aren't provided in the distribution archive.
It is also including various useless resources for us like bootswatch website pages/resources and all of that is creating a very large archive (and sadly useless) webjar.
I can avoid to take bootstrap files from the distribution and instead add a bootstrap webjar dependency to get these files. But this dependency will be used only at the bootswatch packaging time. I'll probably propose to put it with a provided scope as the webjar user won't be able to control the bootstrap version included in the bootswatch webjar. Does it make sense ? Is it cleaner ?

@jamesward
jamesward Jan 13, 2014 Member

Yeah, I think the really tricky part is with hard coded CSS paths since that forces a specific layout. Can you post an example of a hard coded path in bootswatch? If we can't work around this then we can just include the upstream bower_components. It just makes me feel dirty. :)

@aheritier
aheritier Jan 13, 2014

Yes me too :-P
Sample in bootswatch : https://github.com/thomaspark/bootswatch/blob/v3.0.3%2B1/spacelab/bootstrap.css#L2792
Which is coming from bootstrap AFAIK : http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.css (search for fonts/ )
The best solution may be to use less files I think but its not so easy for everyone : https://github.com/twbs/bootstrap/blob/master/less/glyphicons.less

@jamesward
jamesward Jan 13, 2014 Member

Ah, yeah. I remember the Bootstrap tried to pull the glyphicons out of Bootstrap 3 but the CSS path thing caused so many problems that they ended up just including it. So that is what we do in the WebJar: http://www.webjars.org/listfiles/bootstrap/3.0.3

Is the spacelab/bootstrap.css different than the regular bootstrap.css?

@aheritier
aheritier Jan 14, 2014

yes this is where all customizations are done for the theme. The author of bootswatch is adding some less files (a common one and a customized one per theme) to existing bootstrap less files and rebuilds new bootstrap.(min.)css files

@aheritier

I close this PR and I prepare a new one which is integrating all remarks we had here

@aheritier aheritier closed this Jan 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment