public abstract class AbstractSASSController extends AppController
Subclass will compile and serve CSS from SASS files. For more information on SASS, please see https://sass-lang.com/. Usually a developer would subclass this controller to trigger and compile in development environment, but the URI to CSS file would be ignored by the framework (configured in RouteConfig), so that a statically compiled version is served by a container or a web server.
This controller does not by itself compile SASS files. It shells out to a sass
compiler, which
needs to be installed.
The controller will only compile SASS files if there have been any changes since the last invocation. If there has been no changes, it immediately serves the cached version of CSS compiled previously.
public class BootstrapController extends AbstractSASSController { protected File getSASSFile() { return new File("src/main/webapp/sass/bootstrap.sass"); } } ... public class RouteConfig extends AbstractRouteConfig { public void init(AppContext appContext) { ignore("/bootstrap.css").exceptIn("development"); } }The line in the
RouteConfig
ensures that the URI /bootstrap.css
is ignored by the framework
in every environment except "development". This is why the controller is triggering in development environment only.HttpSupport.HttpBuilder, HttpSupport.RenderBuilder
LOGGER
Constructor and Description |
---|
AbstractSASSController() |
Modifier and Type | Method and Description |
---|---|
protected String[] |
getSASSArguments()
Subclass should override this method if they want to provide custom list of arguments to SASS compiler.
|
protected abstract File |
getSASSFile()
Subclass should return a file handle pointing to the main SASS file.
|
void |
index() |
getContentType, getLayout, render, render, restful, restful
assign, blank, encoding, flash, flash, flash, flash, getEncoding, getFile, getHttpServletRequest, getHttpServletResponse, getMap, getMap, getRealPath, getRequestBytes, getRequestInputStream, getRequestStream, getRequestString, getResponseHeaders, header, header, jsonList, jsonMap, jsonMaps, locale, logDebug, logError, logError, logError, logInfo, logWarning, logWarning, merge, multipartForm, multipartForm, multipartFormItems, multipartFormItems, multipartFormItems, outputStream, outputStream, outputStream, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirect, redirectToReferrer, redirectToReferrer, render, respond, sanitize, sendCookie, sendCookie, sendFile, sendFile, sendPermanentCookie, session, session, sessionBoolean, sessionDouble, sessionFloat, sessionHas, sessionInteger, sessionLong, sessionObject, sessionString, setContentLength, setEncoding, setLocale, setRequestEncoding, setResponseEncoding, status, streamOut, uploadedFiles, uploadedFiles, uploadedFiles, values, view, view, view, writer, writer
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appContext, context, cookie, cookies, cookieValue, exists, format, getId, getLocale, getRequestHost, getRequestPort, getRequestProperties, getRequestProtocol, getRoute, header, headers, host, ipAddress, ipForwardedFor, isDelete, isGet, isHead, isMethod, isMultipartContent, isPost, isPut, isXhr, locale, method, param, param, params, params, params, params1st, params1st, path, port, protocol, queryString, remoteAddress, remoteHost, requestHas, servletPath, session, session, uri, url, userAgent, xhr
public void index()
protected abstract File getSASSFile()
protected String[] getSASSArguments()
Copyright © 2022 JavaLite. All rights reserved.