Commit 9701f5a5 authored by colm's avatar colm

Postcss integration:

* a package.json for npm intalling of postcss
* a new definition in our pelican-balsa pelican plugin
→ runs postcss on pelican.signals.finalised routine
* generates a post- appended version of the css file
* use this postcss processed file in the base template
parent 99c84dcd
{
"name": "work.balsamine.www",
"version": "1.0.0",
"description": "Balsamine rebuild 2017 ![logo-balsa](content/images/logo-balsa-16-17-large.svg)",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@gitlab.constantvzw.org:osp/work.balsamine.www.git"
},
"author": "",
"license": "ISC",
"dependencies": {
"caniuse-db": "^1.0.30000670",
"postcss": "^6.0.1",
"postcss-cli": "^4.0.0",
"postcss-cssnext": "^2.11.0"
}
}
......@@ -2,6 +2,7 @@ import os
from pelican import signals
from pelican.readers import METADATA_PROCESSORS
from pelican.utils import get_date
import subprocess, shlex
def add_metadata_processors(arg):
......@@ -19,7 +20,13 @@ def test(pelican):
# call("yuicompressor {} --charset utf-8 {} -o {}".format(
# verbose, filepath, filepath), shell=True)
def process_css(pelican):
cssfile = str(pelican.settings['OUTPUT_PATH'] + '/theme/css/' + pelican.settings['CSS_FILE'])
cssout = str(pelican.settings['OUTPUT_PATH'] + '/theme/css/post-' + pelican.settings['CSS_FILE'])
cmd = str("postcss " + cssfile + " -m --output " + cssout)
call_params = shlex.split(cmd)
subprocess.call(call_params)
def register():
signals.initialized.connect(add_metadata_processors)
# signals.finalized.connect(test)
signals.finalized.connect(process_css)
This diff is collapsed.
......@@ -9,7 +9,7 @@
<meta name="viewport" content="initial-scale=1">
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/reset.css">
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/{{ CSS_FILE }}">
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/post-{{ CSS_FILE }}">
<!-- <link rel="stylesheet" href="http://sorgalla.com/jcarousel/examples/basic/jcarousel.basic.css"> -->
{% endblock head %}
</head>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment