cleanup and add css to gitignore
This commit is contained in:
parent
7295f8b18a
commit
e5e5e4296c
4 changed files with 75 additions and 100 deletions
57
.gitignore
vendored
57
.gitignore
vendored
|
@ -1,8 +1,51 @@
|
||||||
assets/solid-state/
|
# ---> Vim
|
||||||
*.swp
|
# swap
|
||||||
**.swp
|
[._]*.s[a-v][a-z]
|
||||||
*.tmp
|
[._]*.sw[a-p]
|
||||||
*.directory
|
[._]s[a-v][a-z]
|
||||||
**.tmp
|
[._]sw[a-p]
|
||||||
**.directory
|
# session
|
||||||
|
Session.vim
|
||||||
|
# temporary
|
||||||
|
.netrwhist
|
||||||
|
*~
|
||||||
|
# auto-generated tag files
|
||||||
|
tags
|
||||||
|
|
||||||
|
# ---> Windows
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# DS-Store
|
||||||
|
**.DS_Store
|
||||||
|
*.DS_Store
|
||||||
|
|
||||||
|
# C3WOC Website files
|
||||||
|
assets/css/main.css
|
||||||
|
assets/css/main.min.css
|
||||||
|
assets/css/ie9.css
|
||||||
|
assets/css/ie9.min.css
|
||||||
|
.sass-cache/
|
||||||
|
assets/css/main.css.map
|
||||||
|
assets/css/ie9.css.map
|
||||||
|
assets/css/main.min.css.map
|
||||||
|
assets/css/ie9.min.css.map
|
||||||
tmp/
|
tmp/
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
language: python
|
language: python
|
||||||
python: 3.6
|
python: 3.6
|
||||||
|
git:
|
||||||
|
lfs_skip_smudge: true
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/.cache/pip
|
- $HOME/.cache/pip
|
||||||
- $HOME/.cache/lektor/builds
|
- $HOME/.cache/lektor/builds
|
||||||
|
before_install:
|
||||||
|
- git lfs pull
|
||||||
|
- gem install sass
|
||||||
|
- make sass
|
||||||
install: "pip install Lektor"
|
install: "pip install Lektor"
|
||||||
script: "lektor build"
|
script: "lektor build"
|
||||||
before_deploy: "echo 'c3woc.de ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC5NslYj+wtriBuKIxJfDRm9E2hnlstWR8durQ6pKvVvP7wjcoXIyAxe41GvJ9SoEhSjF7oVlzlw+zAkzl5WOZ4=' > ~/.ssh/known_hosts"
|
before_deploy: "echo 'c3woc.de ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC5NslYj+wtriBuKIxJfDRm9E2hnlstWR8durQ6pKvVvP7wjcoXIyAxe41GvJ9SoEhSjF7oVlzlw+zAkzl5WOZ4=' > ~/.ssh/known_hosts"
|
||||||
|
|
|
@ -1,88 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
import sys, re
|
|
||||||
|
|
||||||
def cssMinify(css, saveFileName):
|
|
||||||
# remove comments - this will break a lot of hacks :-P
|
|
||||||
css = re.sub( r'\s*/\*\s*\*/', "$$HACK1$$", css ) # preserve IE<6 comment hack
|
|
||||||
css = re.sub( r'/\*[\s\S]*?\*/', "", css )
|
|
||||||
css = css.replace( "$$HACK1$$", '/**/' ) # preserve IE<6 comment hack
|
|
||||||
|
|
||||||
# url() doesn't need quotes
|
|
||||||
css = re.sub( r'url\((["\'])([^)]*)\1\)', r'url(\2)', css )
|
|
||||||
|
|
||||||
# spaces may be safely collapsed as generated content will collapse them anyway
|
|
||||||
css = re.sub( r'\s+', ' ', css )
|
|
||||||
|
|
||||||
# shorten collapsable colors: #aabbcc to #abc
|
|
||||||
css = re.sub( r'#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3(\s|;)', r'#\1\2\3\4', css )
|
|
||||||
|
|
||||||
# fragment values can loose zeros
|
|
||||||
css = re.sub( r':\s*0(\.\d+([cm]m|e[mx]|in|p[ctx]))\s*;', r':\1;', css )
|
|
||||||
|
|
||||||
for rule in re.findall( r'([^{]+){([^}]*)}', css ):
|
|
||||||
|
|
||||||
# we don't need spaces around operators
|
|
||||||
selectors = [re.sub( r'(?<=[\[\(>+=])\s+|\s+(?=[=~^$*|>+\]\)])', r'', selector.strip() ) for selector in rule[0].split( ',' )]
|
|
||||||
|
|
||||||
# order is important, but we still want to discard repetitions
|
|
||||||
properties = {}
|
|
||||||
porder = []
|
|
||||||
for prop in re.findall( '(.*?):(.*?)(;|$)', rule[1] ):
|
|
||||||
key = prop[0].strip().lower()
|
|
||||||
if key not in porder: porder.append( key )
|
|
||||||
properties[ key ] = prop[1].strip()
|
|
||||||
|
|
||||||
# output rule if it contains any declarations
|
|
||||||
if properties:
|
|
||||||
f = open(saveFileName,'a')
|
|
||||||
f.write( "%s{%s}" % ( ','.join( selectors ), ''.join(['%s:%s;' % (key, properties[key]) for key in porder])[:-1] ) )
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
def fileMin(ifile):
|
|
||||||
returnVal = ''
|
|
||||||
ifSplit = ifile.split('.')
|
|
||||||
for n, filePart in enumerate(ifSplit):
|
|
||||||
if n == len(ifSplit)-1:
|
|
||||||
returnVal = returnVal + "min."
|
|
||||||
returnVal = returnVal + filePart
|
|
||||||
if n != len(ifSplit)-1:
|
|
||||||
returnVal =returnVal + "."
|
|
||||||
return returnVal
|
|
||||||
|
|
||||||
css = ""
|
|
||||||
files = []
|
|
||||||
saveFileName = "style.min.css"
|
|
||||||
flag = False
|
|
||||||
sepFlag = False
|
|
||||||
for n, i in enumerate(sys.argv):
|
|
||||||
if n == 0:
|
|
||||||
pass
|
|
||||||
elif i in ("-h", "--help"):
|
|
||||||
print("Add CSS files space separated to be combined and minified. \n \
|
|
||||||
\t-h, --help \n \
|
|
||||||
\t\tDisplay this help message. \n \
|
|
||||||
\t-o, --output \n \
|
|
||||||
\t\tDeclare name of output CSS file. \n \
|
|
||||||
\t-s, --separate \n \
|
|
||||||
\t\tOutput each individual file as min. i.e.: \n \
|
|
||||||
\t\tstyle.css will become style.min.css")
|
|
||||||
break
|
|
||||||
elif i in ("-o", "--output"):
|
|
||||||
flag = True
|
|
||||||
elif i in ("-s", "--separate"):
|
|
||||||
sepFlag = True
|
|
||||||
elif flag:
|
|
||||||
saveFileName = i
|
|
||||||
flag = False
|
|
||||||
elif sepFlag:
|
|
||||||
files.append(i)
|
|
||||||
else:
|
|
||||||
css += open( i, 'r' ).read()
|
|
||||||
|
|
||||||
if sepFlag:
|
|
||||||
for cssFile in files:
|
|
||||||
css = open(cssFile, 'r').read()
|
|
||||||
cssFile = fileMin(cssFile)
|
|
||||||
cssMinify(css, cssFile)
|
|
||||||
else:
|
|
||||||
cssMinify(css, saveFileName)
|
|
|
@ -1,11 +1,25 @@
|
||||||
<!DOCTYPE html>
|
{% set fqdn = 'c3woc.de'
|
||||||
|
%}<!DOCTYPE html>
|
||||||
<html{% if this.alt %} lang="{{ this.alt }}"{% endif %}>
|
<html{% if this.alt %} lang="{{ this.alt }}"{% endif %}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>{% block title %}Startseite{% endblock %}</title>
|
<title>{% block title %}Startseite{% endblock %} - c3woc.de</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />{%
|
||||||
<link rel="stylesheet" href="{{ '/css/main.min.css'|asseturl }}" />
|
if '/css/main.min.css'|asseturl == empty and '/css/main.css'|asseturl == empty %}
|
||||||
<!--[if lte IE 9]><link rel="stylesheet" href="{{ 'assets/css/ie9.min.css'|asseturl }}" /><![endif]-->
|
<link rel="stylesheet" href="{{ '/css/font-awesome.min.css'|asseturl }}" />
|
||||||
|
<link rel="stylesheet" href="{{ '/fonts/roboto.css'|asseturl }}" />{%
|
||||||
|
endif %}
|
||||||
|
<link rel="stylesheet" href={%
|
||||||
|
if '/css/main.min.css'|asseturl == empty %}{%
|
||||||
|
if '/css/main.css'|asseturl == empty %}"https://{{ fqdn }}/css/main.min.css"{%
|
||||||
|
else %}"{{ '/css/main.css'|asseturl }}"{%
|
||||||
|
endif %}{%
|
||||||
|
else %}"{{ '/css/main.min.css'|asseturl }}"{%
|
||||||
|
endif %} />
|
||||||
|
<!--[if lte IE 9]><link rel="stylesheet" href={%
|
||||||
|
if '/css/ie9.min.css'|asseturl == empty %}"https://{{ fqdn }}/css/ie9.min.css"{%
|
||||||
|
else %}"{{ '/css/ie9.min.css'|asseturl }}"{%
|
||||||
|
endif %}" /><![endif]-->
|
||||||
{% block expand_description
|
{% block expand_description
|
||||||
%}<meta name="description" content="{%
|
%}<meta name="description" content="{%
|
||||||
if bag('translate', this.alt, 'description') %}{{ bag('translate', this.alt, 'description') }}{%
|
if bag('translate', this.alt, 'description') %}{{ bag('translate', this.alt, 'description') }}{%
|
||||||
|
|
Loading…
Reference in a new issue