andriusvelykis / reflow-maven-skin

Reflow is an Apache Maven site skin built on Bootstrap. It allows various structural and stylistic customizations to create a modern-looking Maven-generated website.
http://andriusvelykis.github.io/reflow-maven-skin/
Apache License 2.0
133 stars 54 forks source link

custom css and js resources #31

Closed a1dutch closed 10 years ago

a1dutch commented 10 years ago

allows custom css and js files to be added, these files should be placed in the css & js resource folders.

<custom>
        <reflowSkin>
            <cssResources>
                <cssResource>font-awesome.css</cssResource>
                <cssResource>custom.css</cssResource>
            </cssResources>
            <jsResources>
                <jsResource>custom.js</jsResource>
            </jsResources>
        </reflowSkin>
</custom>
buildhive commented 10 years ago

Andrius Velykis » reflow-maven-skin #29 SUCCESS This pull request looks good (what's this?)

andriusvelykis commented 10 years ago

Hi, thanks for the contribution! However, I think you can achieve the same with existing functionality, as discussed in #24:

For CSS, you can utilise the decoration.head configuration element. It allows adding arbitrary HTML and is preferred for adding any custom JavaScript or CSS to Maven site. Furthermore, it supports Velocity variables, so you could use $resourcePath variable in there (at least it should work like that :)).

For JavaScript, Reflow 1.1.0 added the <endContent> element that allows custom HTML to be placed at the end of the HTML page - see #23.

So to replicate your use case, you would have these in your site.xml:

<project>
...
  <custom>
    <reflowSkin>
      ...
      <endContent>
        <script src="$resourcePath/js/custom.js"></script>
      </endContent>
      ...
    </reflowSkin>
  </custom>

  <body>
    ...
    <head>
      <link href="$resourcePath/css/font-awesome.css" rel="stylesheet" />
      <link href="$resourcePath/css/custom.css" rel="stylesheet" />
    </head>
    ...
  </body>
</project>

I think the current approach is a bit more flexible (e.g. you can add Google profile links to <head> as well, etc.) even though slightly less user-friendly than your proposal.

Let me know if this works for you.

andriusvelykis commented 10 years ago

Closing as there is no reply - and I think the current implementation already supports the use case adequately.