Frontend: Preprocessed Assets
Preprocessors are responsible for converting an asset from one type into another. They're most commonly used for stylesheets and scripts, for example converting styles written in the Sass format to plain CSS. Pakyow includes preprocessors for Sass, Scss, and ES6.
Using Sass & Scss
To write your stylesheets in Sass or Scss, simply replace the .css extension with .sass or .scss. Pakyow will walk you through installing any necessary dependencies, then process these assets on demand.
When referencing preprocessed assets in your view templates, always use the extension the asset will be compiled to. For example, if you have a Sass asset located at
frontend/assets/styles/example.sass
, reference it like this:<link rel="stylesheet" type="text/css" href="/assets/styles/example.css">
Using ES6 features
Pakyow includes support for ECMAScript 6—or ES6—right out of the box with the Babel transpiler. To use ES6 features in your JavaScript, simply add babel-transpiler
to your Gemfile
. Once bundled, Pakyow will automatically transpile your ES6 code to a browser-compatible version.