Skip to content

Instantly share code, notes, and snippets.

Avatar

João Carlos Cabral joaocarloscabral

View GitHub Profile
@joaocarloscabral
joaocarloscabral / gatsby-ssr.js
Created Mar 29, 2021
gatsby-ssr.js removing all javascript files
View gatsby-ssr.js
let pageScripts;
/*
* The "scripts" variable is not documented by Gatsby, https://www.gatsbyjs.org/docs/ssr-apis/#onRenderBody, and that is probably for a good
* reason. The variable contains the scripts the Gatsby internals, https://github.com/gatsbyjs/gatsby/blob/d9cf5a21403c474846ebdf7a0508902b9b8a2ea9/packages/gatsby/cache-dir/static-entry.js#L270-L283,
* puts into the head and post body. We will be relying on this undocumented variable until it does not work anymore as the alternative is
* to read the webpack.stats.json file and parse it ourselves.
*/
export function onRenderBody({ scripts }) {
if (process.env.NODE_ENV !== 'production') { // During a gatsby development build (gatsby develop) we do nothing.
return;
View tripfaces.example.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:trip="http://tripfaces.org/components"
template="../templates/template.xhtml">
...
<trip:tour widgetVar="trip" >
View tripfaces.pom.xml
<dependencies>
...
<dependency>
<groupId>org.tripfaces</groupId>
<artifactId>components</artifactId>
<version>1.0.0</version>
<type>war</type>
</dependency>
</dependencies>