Permalink
Browse files

+features +bugfix

pre-final

bugfix

bugfix
  • Loading branch information...
1 parent 470b16d commit 3ff15ddc6050613ccd3deb463b8397f4dd820988 @padenot padenot committed Sep 27, 2011
Showing with 135 additions and 295 deletions.
  1. +2 −1 .gitignore
  2. +13 −17 build.sh
  3. +94 −0 comments.sed
  4. +0 −82 nginx-mime.types
  5. +0 −126 nginx.conf
  6. +12 −0 rep.py
  7. +3 −2 yadfig.html
  8. +11 −67 yadfig.py
View
@@ -1 +1,2 @@
-media/*
+vasa/*
+yadfig
View
@@ -1,27 +1,23 @@
#!/bin/sh
# Pack CSS in out.css
-cat css/style.css | sed -e '
-s/^[ \t]*//g; # remove leading space
-s/[ \t]*$//g; # remove trailing space
-s/\([:{;,]\) /\1/g; # remove space after a colon, brace, semicolon, or comma
-s/ {/{/g; # remove space before a semicolon
-s/\/\*.*\*\///g; # remove comments
-/^$/d # remove blank lines
-' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta # remove all newlines
-' > out.css
+./comments.sed < css/style.css > out.css
+sed ':a;N;$!ba;s/\n/ /g' out.css | tr -s ' ' > out2.css
+mv out2.css out.css
# Put it in index.html
-sed 's/__CSS__/`cat out.css`/' yadfig.html > index.html
+echo "css"
+python rep.py out.css yadfig.html __CSS__ > index.html
-rm out.css
-
-# minify js
+echo "js"
jsmin < js/script.js > out.js
-sed -i 's/__SCRIPT__/`cat out.js`/' index.html
-
-rm out.js
+python rep.py out.js index.html __SCRIPT__> index2.html
+mv index2.html index.html
-sed 's/__TEMPLATE__/`cat index.html`/' yadfig.py > yadfig
+echo "py"
+python rep.py index.html yadfig.py __TEMPLATE__ > yadfig
+rm index.html
+rm out.js
+rm out.css
View
@@ -0,0 +1,94 @@
+#! /bin/sed -nf
+
+# Remove C and C++ comments, by Brian Hiles (brian_hiles@rocketmail.com)
+
+# Sped up (and bugfixed to some extent) by Paolo Bonzini (bonzini@gnu.org)
+# Works its way through the line, copying to hold space the text up to the
+# first special character (/, ", '). The original version went exactly a
+# character at a time, hence the greater speed of this one. But the concept
+# and especially the trick of building the line in hold space are entirely
+# merit of Brian.
+
+:loop
+
+# This line is sufficient to remove C++ comments!
+/^\/\// s,.*,,
+
+/^$/{
+ x
+ p
+ n
+ b loop
+}
+/^"/{
+ :double
+ /^$/{
+ x
+ p
+ n
+ /^"/b break
+ b double
+ }
+
+ H
+ x
+ s,\n\(.[^\"]*\).*,\1,
+ x
+ s,.[^\"]*,,
+
+ /^"/b break
+ /^\\/{
+ H
+ x
+ s,\n\(.\).*,\1,
+ x
+ s/.//
+ }
+ b double
+}
+
+/^'/{
+ :single
+ /^$/{
+ x
+ p
+ n
+ /^'/b break
+ b single
+ }
+ H
+ x
+ s,\n\(.[^\']*\).*,\1,
+ x
+ s,.[^\']*,,
+
+ /^'/b break
+ /^\\/{
+ H
+ x
+ s,\n\(.\).*,\1,
+ x
+ s/.//
+ }
+ b single
+}
+
+/^\/\*/{
+ s/.//
+ :ccom
+ s,^.[^*]*,,
+ /^$/ n
+ /^\*\//{
+ s/..//
+ b loop
+ }
+ b ccom
+}
+
+:break
+H
+x
+s,\n\(.[^"'/]*\).*,\1,
+x
+s/.[^"'/]*//
+b loop
View
@@ -1,82 +0,0 @@
-# this file is used by the nginx.conf
-
-types {
- text/html html htm shtml;
- text/css css;
- text/xml xml rss;
- image/gif gif;
- image/jpeg jpeg jpg;
- application/javascript js;
- application/atom+xml atom;
-
- text/cache-manifest manifest appcache;
- text/mathml mml;
- text/plain txt;
- text/vnd.sun.j2me.app-descriptor jad;
- text/vnd.wap.wml wml;
- text/x-component htc;
-
- image/png png;
- image/svg+xml svg svgz;
- image/tiff tif tiff;
- image/vnd.wap.wbmp wbmp;
- image/webp webp;
- image/x-icon ico;
- image/x-jng jng;
- image/x-ms-bmp bmp;
-
- application/java-archive jar war ear;
- application/mac-binhex40 hqx;
- application/msword doc;
- application/pdf pdf;
- application/postscript ps eps ai;
- application/rtf rtf;
- application/vnd.ms-excel xls;
- application/vnd.ms-powerpoint ppt;
- application/vnd.wap.wmlc wmlc;
- application/vnd.wap.xhtml+xml xhtml;
- application/x-chrome-extension crx;
- application/x-cocoa cco;
- application/x-java-archive-diff jardiff;
- application/x-java-jnlp-file jnlp;
- application/x-makeself run;
- application/x-perl pl pm;
- application/x-pilot prc pdb;
- application/x-rar-compressed rar;
- application/x-redhat-package-manager rpm;
- application/x-sea sea;
- application/x-shockwave-flash swf;
- application/x-stuffit sit;
- application/x-tcl tcl tk;
- application/x-x509-ca-cert der pem crt;
- application/x-xpinstall xpi;
- application/zip zip;
-
- application/octet-stream bin exe dll;
- application/octet-stream deb;
- application/octet-stream dmg;
- application/octet-stream iso img;
- application/octet-stream msi msp msm;
- application/octet-stream safariextz
-
- audio/midi mid midi kar;
- audio/mpeg mp3;
- audio/x-realaudio ra;
- audio/ogg oga ogg;
-
- video/3gpp 3gpp 3gp;
- video/mpeg mpeg mpg;
- video/ogg ogv;
- video/quicktime mov;
- video/webm webm;
- video/x-flv flv;
- video/x-mng mng;
- video/x-ms-asf asx asf;
- video/x-ms-wmv wmv;
- video/x-msvideo avi;
-
- application/vnd.ms-fontobject eot;
- font/truetype ttf;
- font/opentype otf;
- font/woff woff;
-}
View
@@ -1,126 +0,0 @@
-# Set another default user than root for security reasons
-user www www;
-
-# As a thumb rule: One per CPU. If you are serving a large amount
-# of static files, which requires blocking disk reads, you may want
-# to increase this from the number of cpu_cores available on your
-# system.
-#
-# The maximum number of connections for Nginx is calculated by:
-# max_clients = worker_processes * worker_connections
-worker_processes 1;
-
-# Maximum file descriptors that can be opened per process
-# This should be > worker_connections
-worker_rlimit_nofile 8192;
-
-events {
- # When you need > 8000 * cpu_cores connections, you start optimizing
- # your OS, and this is probably the point at where you hire people
- # who are smarter than you, this is *a lot* of requests.
- worker_connections 8000;
-}
-
-# Change these paths to somewhere that suits you!
-error_log logs/error.log;
-pid logs/nginx.pid;
-
-http {
- # Set the mime-types via the mime.types external file
- include nginx-mime.types;
-
- # And the fallback mime-type
- default_type application/octet-stream;
-
- # Format for our log files
- log_format main '$remote_addr - $remote_user [$time_local] $status '
- '"$request" $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
-
- # Click tracking!
- access_log logs/access.log main;
-
- # ~2 seconds is often enough for HTML/CSS, but connections in
- # Nginx are cheap, so generally it's safe to increase it
- keepalive_timeout 20;
-
- # You usually want to serve static files with Nginx
- sendfile on;
-
- tcp_nopush on; # off may be better for Comet/long-poll stuff
- tcp_nodelay off; # on may be better for Comet/long-poll stuff
-
- # Enable Gzip:
- gzip on;
- gzip_http_version 1.0;
- gzip_comp_level 5;
- gzip_min_length 512;
- gzip_buffers 4 8k;
- gzip_proxied any;
- gzip_types
- # text/html is always compressed by HttpGzipModule
- text/css
- text/javascript
- text/xml
- text/plain
- text/x-component
- application/javascript
- application/json
- application/xml
- application/rss+xml
- font/truetype
- font/opentype
- application/vnd.ms-fontobject
- image/svg+xml;
-
- # This should be turned on if you are going to have pre-compressed copies (.gz) of
- # static files available. If not it should be left off as it will cause extra I/O
- # for the check. It would be better to enable this in a location {} block for
- # a specific directory:
- # gzip_static on;
-
- gzip_disable "MSIE [1-6]\.";
- gzip_vary on;
-
- server {
- # listen 80 default_server deferred; # for Linux
- # listen 80 default_server accept_filter=httpready; # for FreeBSD
- listen 80 default_server;
-
- # e.g. "localhost" to accept all connections, or "www.example.com"
- # to handle the requests for "example.com" (and www.example.com)
- # server_name www.example.com;
-
- # Path for static files
- root /sites/example.com/public;
-
- # Custom 404 page
- error_page 404 /404.html;
-
- # This is pretty long expiry and assume your using
- # cachebusting with query params like
- # <script src="application.js?20110529">
- #
- # Just be careful if your using this on a frequently
- # updated static site. You may want to crank this back
- # to 5m which is 5 minutes.
- expires 1M; # yes one month
-
- # Static assets
- location ~* ^.+\.(manifest|appcache)$ {
- expires -1;
- access_log logs/static.log;
- }
-
- # Set expires max on static file types (make sure you are using cache busting filenames or query params):
- location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
- expires max;
- access_log off;
- }
-
- # opt-in to the future
- add_header "X-UA-Compatible" "IE=Edge,chrome=1";
-
- }
-}
-
View
12 rep.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+
+import codecs
+import sys
+
+#print sys.argv[1], sys.argv[2], sys.argv[3]
+sys.stdout = codecs.getwriter('utf8')(sys.stdout)
+toInsert = codecs.open(sys.argv[1], encoding="utf-8").read()
+where = codecs.open(sys.argv[2], encoding="utf-8").read()
+where = where.replace(sys.argv[3], toInsert)
+print where
+
View
@@ -13,7 +13,6 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
- <link rel="stylesheet" href="css/style.css">
<style>
__CSS__
</style>
@@ -54,7 +53,9 @@
</div>
</div>
-<script src="js/script.js"></script>
+<script>
+__SCRIPT__
+</script>
<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
Oops, something went wrong.

0 comments on commit 3ff15dd

Please sign in to comment.