Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-1067

Adopt WebJars as encapsulation for Bootstrap and JQuery resources

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.3.Final
    • Fix Version/s: 3.x Future
    • Component/s: Scaffold
    • Labels:
      None

      Description

      At the moment JBoss Forge copies the bootstrap.css into the resources directory. It would be nice to use WebJar [1] to package Bootstrap (and JQuery) into the war file.

      For this to happen you just need to add the following Maven dependencies to the pom.xml :

            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>bootstrap</artifactId>
                <version>2.3.2</version>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>jquery</artifactId>
                <version>2.0.3</version>
            </dependency>
      

      Then, change the pageTemplate.xhtml so it looks like this :

      <!DOCTYPE html>
      <html xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:ui="http://java.sun.com/jsf/facelets">
       
      <h:head>
          <title>#{empty pageTitle ? '{#pageTitle}' : pageTitle}</title>
          <link rel="icon" href="#{resource['favicon.ico']}"/>
          <h:outputStylesheet library="webjars/bootstrap/2.3.2/css" name="bootstrap.min.css"/>
          <h:outputStylesheet name="forge-style.css"/>
      </h:head>
       
      <h:body>
          ...
          ...
          ...
          <!-- Bootstrap core JavaScript
          ================================================== -->
          <!-- Placed at the end of the document so the pages load faster -->
          <h:outputScript name="webjars/jquery/2.0.3/jquery.min.js"/>
          <h:outputScript library="webjars/bootstrap/2.3.2/js" name="bootstrap.min.js"/>
       
       
      </h:body>
      </html>
      

      And of course, get rid of the bootstrap.css file ;o)

      [1] http://www.webjars.org/
      [1] http://www.jamesward.com/2012/10/31/webjars-officially-launched
      See also : https://issues.jboss.org/browse/RF-12584

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  agoncal Antonio Goncalves
                • Votes:
                  4 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated: