lektor-cheatsheet

written by Eli,,, on 2017-03-26

webpack

npm install --save-dev webpack babel-core babel-loader css-loader url-loader style-loader file-loader extract-text-webpack-plugin less less-loader node-sass sass-loader eventualy

var webpack = require('webpack');
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');


var options = {
  entry: {
    'app': './js/main.js',
    'styles': './scss/main.scss'
  },
  output: {
    path: path.dirname(__dirname) + '/assets/static/gen',
    filename: '[name].js'
  },
  devtool: '#cheap-module-source-map',
  resolve: {
    modulesDirectories: ['node_modules'],
    extensions: ['', '.js']
  },
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'babel-loader'
      },
      {
        test: /\.scss$/,
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
      },
      {
        test: /\.css$/,
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
      },
      {
        test: /\.woff2?$|\.ttf$|\.eot$|\.svg$|\.png|\.jpe?g\|\.gif$/,
        loader: 'file'
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin('styles.css', {
      allChunks: true
    }),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.DedupePlugin()
  ]
};

module.exports = options;

to run the server and auto-generate

lektor server -f webpack

how-to

get latest post with alt language selection

{% set pages = site.query('./blog', alt=alt).all() %}
{% for page in pages[0:5] %}
  <li>
  <a href="./blog/{{ page._id }}"> {{ page.title }}</a>
  </li>
  {% endif %}
{% endfor %}

external js libs

list carousel

image carousel slick

slide

svg to canvas

svg to canvas

svg edit

svg free library

canvas hit detection

not listed plugins

json source for pages

embed youtube and twitter

google drive

static search

algolia search

not listed external apps

django hosted admin panel

websites made with lektor

blog

boiler plate with complex flow

dgplug

piktor

https://shrike.me/

external services API

messaging and VoIP riot

notes taken on lektor

writing plugins

notes on code

general notes

migrating to lektor