Home

Awesome

Affresco

Affresco

Affresco (IPA: /af'fresko/) is Hufvudstadsbladet Ab's frontend monorepo: as many beautiful scenes are contained in a fresco, many beautiful frontends can be found in this repo.

production

DeployLang(s)
Mitt KontoPureScript
KSF National ElectionsJavaScript
KSF EU ElectionsJavaScript
ScriptsJS
Vetrina (test)PS
PodcastsJS
Podcasts (VN)JS

Developing

To install all packages run yarn install in the root of the repo.

You might also want to install the tools globally for more convenience: npm install -g purescript spago parcel

We have different kinds of apps, and they require different initial setup. Move inside of some app's folder (e.g. apps/mitt-konto), and then:

After this initial setup, running yarn start should give you a hot reloading local dev server.

Structure

It's a monorepo, and there's a separation between packages and apps:

Sharing assets

All assets are shared by all packages and apps:

Styles

All styles should be placed under /less. The file should be named after the component it belongs to. Also note that the file Components.less conveniently imports every less file associated with a component. Newly created styles should be added to this file.

Production build

Apps

For building and deploying single page applications from apps/, the deploy.rb script is used.

$ ruby deploy.rb $APP_NAME

NB: This applies for all except app-article-server which is deployed from a mirrored repo in gitlab. Please see .gitlab-ci.yml for more details.

Scripts

For static scripts, the build command is defined in CI. In this case, we just want to minify all content under scripts/.

# A simple one-liner to minify all js files
ruby -e 'Dir.glob("scripts/**/*.js").each { |f| `uglifyjs #{f} -o #{f.gsub(/js\z/, "min.js")}` }'

Here, for example, a file scripts/apps/appScript.js is minified to scripts/apps/appScript.min.js.

Adding a new deployment

See the CI README for info about the CI setup, and how to add a new app.