SCSS and JS

The Fast Way

  • write your SCSS in src/stylesheets/screen.scss
  • write your JS in src/javascripts/application.js

and all will automagically work! :)

A real explanation

Wordless has 2 different places where you want to put your assets (javascript, css, images):

  • Place all your custom, project related assets into src/*
  • Since you are backed by Webpack, you can use NPM (node_modules) to import new dependencies following a completely standard approach

Custom assets

They must be placed inside src/javascript/ and src/stylesheets/ and src/images/.

They will be compiled and resulting compilation files will be moved in the corresponding assets/xxx folder.

Compilation, naming and other logic is fully handled by webpack.

Images will be optimized by image-minimizer-webpack-plugin. The default setup already translates url s inside css/scss files in order to point to images in the right folder.

Take a look to the default screen.scss and application.js to see usage examples.

See also

Code compilation

node_modules

You can use node modules just as any SO answer teaches you :)

Add any vendor library through YARN with

yarn add slick-carousel

Then in your Javascript you can do

require('slick-carousel');

or if the library exports ES6 modules you can do

import { export1 } from "module-name";

and go on as usual.