[geeklog-hg] geeklog: Denim: Added new source code for building style.css. It...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Apr 8 12:18:15 EDT 2015


changeset 9584:46ab44276b13
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/46ab44276b13
user: dengen <taharaxp at gmail.com>
date: Thu Apr 09 00:56:26 2015 +0900
description:
Denim: Added new source code for building style.css. It is necessary to install Node.js to compile this source code.

diffstat:

 public_html/layout/denim/css_src/.csscomb.json                                       |   23 +
 public_html/layout/denim/css_src/README                                              |   15 +
 public_html/layout/denim/css_src/gulpfile.js                                         |  174 ++
 public_html/layout/denim/css_src/package.json                                        |   39 +
 public_html/layout/denim/css_src/src/stylus/config.json                              |   62 +
 public_html/layout/denim/css_src/src/stylus/config2.json                             |   62 +
 public_html/layout/denim/css_src/src/stylus/style.styl                               |   15 +
 public_html/layout/denim/css_src/src/stylus/sub/admin.styl                           |  379 ++++
 public_html/layout/denim/css_src/src/stylus/sub/admin_config.styl                    |  247 +++
 public_html/layout/denim/css_src/src/stylus/sub/base.styl                            |  297 +++
 public_html/layout/denim/css_src/src/stylus/sub/block_contents.styl                  |  766 ++++++++++
 public_html/layout/denim/css_src/src/stylus/sub/compatible.styl                      |  374 ++++
 public_html/layout/denim/css_src/src/stylus/sub/form_basic.styl                      |  207 ++
 public_html/layout/denim/css_src/src/stylus/sub/layout/layout_1cols_mobile.styl      |  246 +++
 public_html/layout/denim/css_src/src/stylus/sub/layout/layout_2cols_Rbar_fixed.styl  |  283 +++
 public_html/layout/denim/css_src/src/stylus/sub/layout/layout_2cols_Rbar_liquid.styl |  262 +++
 public_html/layout/denim/css_src/src/stylus/sub/layout/layout_3cols_LRbar.styl       |  279 +++
 public_html/layout/denim/css_src/src/stylus/sub/layout_2.styl                        |   41 +
 public_html/layout/denim/css_src/src/stylus/sub/layout_default.styl                  |   41 +
 public_html/layout/denim/css_src/src/stylus/sub/main_contents.styl                   |  638 ++++++++
 public_html/layout/denim/css_src/src/stylus/sub/mixins.styl                          |  121 +
 public_html/layout/denim/css_src/src/stylus/sub/theme_2.styl                         |   72 +
 public_html/layout/denim/css_src/src/stylus/sub/theme_default.styl                   |   22 +
 public_html/layout/denim/css_src/src/stylus/sub/variables.styl                       |   13 +
 public_html/layout/denim/css_src/src/stylus/sub/variables_default.styl               |  178 ++
 public_html/layout/denim/images/logo2.png                                            |  Bin 
 public_html/layout/denim/images/texture.jpg                                          |  Bin 
 27 files changed, 4856 insertions(+), 0 deletions(-)

diffs (truncated from 4962 to 300 lines):

diff -r 0a7e14b855f3 -r 46ab44276b13 public_html/layout/denim/css_src/.csscomb.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/css_src/.csscomb.json	Thu Apr 09 00:56:26 2015 +0900
@@ -0,0 +1,23 @@
+{
+    "remove-empty-rulesets": true,
+    "color-case": "upper",
+    "block-indent": "  ",
+    "color-shorthand": true,
+    "element-case": "lower",
+    "eof-newline": true,
+    "leading-zero": false,
+    "quotes": "double",
+    "space-before-colon": "",
+    "space-after-colon": " ",
+    "space-before-combinator": " ",
+    "space-after-combinator": " ",
+    "space-between-declarations": "\n",
+    "space-before-opening-brace": " ",
+    "space-after-opening-brace": "\n",
+    "space-after-selector-delimiter": "\n",
+    "space-before-selector-delimiter": "",
+    "space-before-closing-brace": "\n",
+    "strip-spaces": true,
+    "tab-size": 2,
+    "unitless-zero": true
+}
\ No newline at end of file
diff -r 0a7e14b855f3 -r 46ab44276b13 public_html/layout/denim/css_src/README
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/css_src/README	Thu Apr 09 00:56:26 2015 +0900
@@ -0,0 +1,15 @@
+Building style.css for Denim theme
+-----------------------------------
+1) First of all, install Node.
+   https://nodejs.org/
+
+2) Open shell.
+
+3) Install the Node dependencies.
+
+   $ cd css_src
+   $ npm install
+
+4) Build and deploy style.css.
+
+   $ npm run build
diff -r 0a7e14b855f3 -r 46ab44276b13 public_html/layout/denim/css_src/gulpfile.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/css_src/gulpfile.js	Thu Apr 09 00:56:26 2015 +0900
@@ -0,0 +1,174 @@
+var pkg         = require('./package.json'),
+    fs          = require('fs'),
+    path        = require('path'),
+    glob        = require('glob'),
+    gulp        = require('gulp'),
+    stylus      = require('gulp-stylus'),
+    runSequence = require('run-sequence').use(gulp),
+    shell       = require('gulp-shell'),
+    rename      = require('gulp-rename'),
+    minifycss   = require('gulp-minify-css'),
+    csscomb     = require('gulp-csscomb'),
+    //cmq         = require('gulp-combine-media-queries'),
+    //csso        = require('gulp-csso'),
+    header      = require('gulp-header'),
+    replace     = require('gulp-replace'),
+    watch       = require('gulp-watch'),
+    nib         = require('nib'),
+    mkdirp      = require('mkdirp'),
+    browserSync = require('browser-sync');
+
+//var site_url  = 'http://localhost:8000/your_site'; // set the same value as the $_CONF['site_url']
+var site_url  = 'http://localhost:8080/work/nightly12/'; // set the same value as the $_CONF['site_url']
+
+var banner = "<%= pkg.title %> <%= pkg.version %> | Copyright (C) 2012-2015 by <%= pkg.author %> | <%= pkg.homepage %> | License:<%= pkg.license %>";
+
+gulp.task('default', ['build'], function() {
+
+});
+
+gulp.task('watch', function() {
+    if (site_url !== '') {
+        browserSync({
+            proxy: site_url
+        });
+    }
+    watch(['./src/stylus/**/*.styl', './src/stylus/*.json'], function() {
+        gulp.start('build');
+    });
+});
+
+gulp.task('bs-reload', function () {
+    browserSync.reload();
+});
+
+gulp.task('build', function() {
+    runSequence('stylus', 'copy_LR', 'swap_LR', ['minify1', 'minify2', 'modify'], 'deploy', function() {
+        browserSync.reload();
+    });
+});
+
+gulp.task('stylus', function() {
+    return gulp.src('./src/stylus/style.styl')
+        .pipe(stylus({
+            use: nib(),
+            compress: false
+        }))
+        //.pipe(cmq())
+        .pipe(csscomb())
+        .pipe(header("/* " + banner + " */\n", { 'pkg' : pkg } ))
+        .pipe(gulp.dest('./dest/css_ltr'));
+});
+
+gulp.task('minify1', function() {
+    return gulp.src(['!./dest/css_ltr/*.min.css', './dest/css_ltr/*.css'])
+        .pipe(rename({ suffix: '.min' }))
+        //.pipe(cmq())
+        //.pipe(csso())
+        .pipe(minifycss())
+        .pipe(header("/* " + banner + " */\n", { 'pkg' : pkg } ))
+        .pipe(gulp.dest('./dest/css_ltr'));
+});
+
+gulp.task('minify2', function() {
+    return gulp.src(['!./dest/css_rtl/*.min.css', './dest/css_rtl/*.css'])
+        .pipe(rename({ suffix: '.min' }))
+        //.pipe(cmq())
+        //.pipe(csso())
+        .pipe(minifycss())
+        .pipe(header("/* " + banner + " */\n", { 'pkg' : pkg } ))
+        .pipe(gulp.dest('./dest/css_rtl'));
+});
+
+gulp.task('deploy', function() {
+    return gulp.src('./dest/**')
+        .pipe(gulp.dest('./../'));
+});
+
+gulp.task('copy_LR', function() {
+    return gulp.src('./dest/css_ltr/*')
+        .pipe(gulp.dest('./dest/css_rtl/'));
+});
+
+gulp.task('swap_LR',
+    shell.task([
+        'r2 ./dest/css_rtl/style.css ./dest/css_rtl/style.css --no-compress'
+    ])
+);
+
+gulp.task('mkdir', function(done) {
+    mkdirp('./dest/css_rtl')
+    done();
+});
+
+gulp.task('modify', function(done) {
+
+    var regex = /(\/\*\/?(?:\n|[^\/]|[^\*]\/)*\*\/)|(^@media\s+[^\n]+\{\n(?:\n|.)*?\n\})|(^(?:#|\.|\w)(?:\n|.)+?\{\n(?:\n|.)*?\n\})/mg;
+
+    glob('./dest/css_?t?/style.css', function (err, files) {
+
+        if (err) throw err;
+
+        files.forEach(function(file) {
+
+            var str = [];
+
+            fs.readFile(file, {encoding: 'utf-8'}, function(err, content) {
+
+                if (err) throw err;
+
+                var matches, tmp;
+
+                while (matches = regex.exec(content)) {
+                    if (matches[1] !== undefined) { // comment
+                        tmp = matches[1];
+                        if (tmp.indexOf('\n') != -1) {
+                            tmp += '\n';
+                        }
+                        str.push(tmp);
+                    }
+                    if (matches[2] !== undefined) { // @media
+                        tmp = modifyMedia(matches[2]);
+                        tmp += '\n';
+                        str.push(tmp);
+                    }
+                    if (matches[3] !== undefined) { // CSS rule set
+                        str.push(matches[3] + '\n');
+                    }
+                }
+                fs.writeFile(file, str.join('\n'), function(err) {
+                    if (err) throw err;
+                });
+            });
+        });
+    });
+    done();
+});
+
+function modifyMedia(content) {
+
+    var regex = /^(@media\s+[^\n]+\{\n)((?:\n|.)*?)(\n\})/mg;
+
+    var matches = regex.exec(content);
+
+    var regex2 = /(\/\*\/?(?:\n|[^\/]|[^\*]\/)*\*\/)|(^  (?:#|\.|\w)(?:\n|.)+?\{\n(?:\n|.)*?\n  \})/mg;
+
+    var ms, str = '', tmp;
+
+    while (ms = regex2.exec(matches[2])) {
+        if (ms[1] !== undefined) {
+            tmp = ms[1];
+            if (tmp.indexOf('\n') != -1) {
+                tmp = tmp.replace(/\n/g, '\n  ');
+                tmp += '\n';
+            }
+            str = str + '  ' + tmp + '\n';
+        }
+        if (ms[2] !== undefined) {
+            str = str + ms[2] + '\n\n';
+        }
+    }
+    str = '\n  ' + str.trim();
+
+    return matches[1] + str + matches[3];
+}
\ No newline at end of file
diff -r 0a7e14b855f3 -r 46ab44276b13 public_html/layout/denim/css_src/package.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/css_src/package.json	Thu Apr 09 00:56:26 2015 +0900
@@ -0,0 +1,39 @@
+{
+  "name": "Denim",
+  "title": "Geeklog Denim Theme",
+  "version": "1.1.0",
+  "homepage": "http://www.trybese.com/~dengen/log/",
+  "description": "Geeklog Denim Theme Project",
+  "main": "index.js",
+  "scripts": {
+    "build": "gulp build",
+    "watch": "gulp watch"
+  },
+  "keywords": [
+    "geeklog",
+    "denim",
+    "theme"
+  ],
+  "author": "dengen",
+  "license": "GPLv2",
+  "devDependencies": {
+    "R2": "^1.4.3",
+    "browser-sync": "^2.2.4",
+    "glob": "^5.0.3",
+    "gulp": "^3.8.10",
+    "gulp-combine-media-queries": "^0.2.0",
+    "gulp-csscomb": "^3.0.3",
+    "gulp-csso": "^0.2.9",
+    "gulp-header": "^1.2.2",
+    "gulp-minify-css": "^0.3.11",
+    "gulp-rename": "^1.2.0",
+    "gulp-replace": "^0.5.3",
+    "gulp-shell": "^0.2.11",
+    "gulp-stylus": "^2.0.0",
+    "gulp-watch": "^4.2.1",
+    "mkdirp": "^0.5.0",
+    "nib": "^1.1.0",
+    "run-sequence": "^1.0.2",
+    "stylus": "^0.49.3"
+  }
+}
diff -r 0a7e14b855f3 -r 46ab44276b13 public_html/layout/denim/css_src/src/stylus/config.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/denim/css_src/src/stylus/config.json	Thu Apr 09 00:56:26 2015 +0900
@@ -0,0 +1,62 @@
+{
+    "$var": {
+        "name": "default",
+        "style-mode": "1",
+        "header-style": "normal",
+        "sitename-style": "text",
+        "base-color": "#426F9C",
+        "adjust-hue": "true",
+        "global-navigation-style": "default",
+        "flip-horizontal": "false"
+    },
+    "$base": {
+        "text-color": "#222",
+        "anker-color": "#2661A2"
+    },
+    "$container": {
+        "background": "#FFF",
+        "margin": {
+            "top": "0",
+            "bottom": "0"
+        },
+        "padding": "0",
+        "border": {
+            "size": "0",
+            "color": "#000",
+            "style": "solid"
+        }



More information about the geeklog-cvs mailing list