Changeset - 11affd72f64c
[Not reviewed]
default
0 3 0
Mads Kiilerich - 7 years ago 2018-12-11 01:40:17
mads@kiilerich.com
front-end: Drop lessc --relative-urls

The Fontello font paths in kallithea/public/fontello/css/kallithea.css were
adjusted by the relative urls option - instead we now hack the source.

The Bootstrap Glyph icons are not used - set their name to make it clear they
intentionally not are used.
3 files changed with 12 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/bin/kallithea_cli_front_end.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
import click
 
import kallithea.bin.kallithea_cli_base as cli_base
 

	
 
import os
 
import shutil
 
import subprocess
 
import json
 

	
 
import kallithea
 

	
 
@cli_base.register_command()
 
@click.option('--install-deps/--no-install-deps', default=True,
 
        help='Skip installation of dependencies, via "npm".')
 
@click.option('--generate/--no-generate', default=True,
 
        help='Skip generation of front-end files.')
 
def front_end_build(install_deps, generate):
 
    """Build the front-end.
 

	
 
    Install required dependencies for the front-end and generate the necessary
 
    files.  This step is complementary to any 'pip install' step which only
 
    covers Python dependencies.
 

	
 
    The installation of front-end dependencies happens via the tool 'npm' which
 
    is expected to be installed already.
 
    """
 
    front_end_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'front-end'))
 
    public_dir = os.path.abspath(os.path.join(kallithea.__file__, '..', 'public'))
 

	
 
    if install_deps:
 
        click.echo("Running 'npm install' to install front-end dependencies from package.json")
 
        subprocess.check_call(['npm', 'install'], cwd=front_end_dir)
 

	
 
    if generate:
 
        tmp_dir = os.path.join(front_end_dir, 'tmp')
 
        if not os.path.isdir(tmp_dir):
 
            os.mkdir(tmp_dir)
 

	
 
        click.echo("Building CSS styling based on Bootstrap")
 
        with open(os.path.join(tmp_dir, 'pygments.css'), 'w') as f:
 
            subprocess.check_call(['pygmentize',
 
                    '-S', 'default',
 
                    '-f', 'html',
 
                    '-a', '.code-highlight'],
 
                    stdout=f)
 
        lesscpath = os.path.join(front_end_dir, 'node_modules', '.bin', 'lessc')
 
        lesspath = os.path.join(public_dir, 'less', 'main.less')
 
        csspath = os.path.join(public_dir, 'css', 'style.css')
 
        subprocess.check_call([lesscpath, '--relative-urls', '--source-map',
 
        subprocess.check_call([lesscpath, '--source-map',
 
                '--source-map-less-inline', lesspath, csspath],
 
                cwd=front_end_dir)
 

	
 
        click.echo("Preparing Bootstrap JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'bootstrap', 'dist', 'js', 'bootstrap.js'), os.path.join(public_dir, 'js', 'bootstrap.js'))
 

	
 
        click.echo("Preparing jQuery JS with Flot, Caret and Atwho")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery', 'dist', 'jquery.min.js'), os.path.join(public_dir, 'js', 'jquery.min.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.js'), os.path.join(public_dir, 'js', 'jquery.flot.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.selection.js'), os.path.join(public_dir, 'js', 'jquery.flot.selection.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.flot', 'jquery.flot.time.js'), os.path.join(public_dir, 'js', 'jquery.flot.time.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'jquery.caret', 'dist', 'jquery.caret.min.js'), os.path.join(public_dir, 'js', 'jquery.caret.min.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'at.js', 'dist', 'js', 'jquery.atwho.min.js'), os.path.join(public_dir, 'js', 'jquery.atwho.min.js'))
 

	
 
        click.echo("Preparing DataTables JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'datatables.net', 'js', 'jquery.dataTables.js'), os.path.join(public_dir, 'js', 'jquery.dataTables.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'datatables.net-bs', 'js', 'dataTables.bootstrap.js'), os.path.join(public_dir, 'js', 'dataTables.bootstrap.js'))
 

	
 
        click.echo("Preparing Select2 JS")
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.js'), os.path.join(public_dir, 'js', 'select2.js'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2.png'), os.path.join(public_dir, 'css', 'select2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2x2.png'), os.path.join(public_dir, 'css', 'select2x2.png'))
 
        shutil.copy(os.path.join(front_end_dir, 'node_modules', 'select2', 'select2-spinner.gif'), os.path.join(public_dir, 'css', 'select2-spinner.gif'))
 

	
 
        click.echo("Preparing CodeMirror JS")
 
        if os.path.isdir(os.path.join(public_dir, 'codemirror')):
 
            shutil.rmtree(os.path.join(public_dir, 'codemirror'))
 
        shutil.copytree(os.path.join(front_end_dir, 'node_modules', 'codemirror'), os.path.join(public_dir, 'codemirror'))
 

	
 
        click.echo("Generating LICENSES.txt")
 
        check_licensing_json_path = os.path.join(tmp_dir, 'licensing.json')
 
        licensing_txt_path = os.path.join(public_dir, 'LICENSES.txt')
 
        subprocess.check_call([
 
            os.path.join(front_end_dir, 'node_modules', '.bin', 'license-checker'),
 
            '--json',
 
            '--out', check_licensing_json_path,
 
            ], cwd=front_end_dir)
 
        with open(check_licensing_json_path) as jsonfile:
 
            rows = json.loads(jsonfile.read())
 
            with open(licensing_txt_path, 'w') as out:
 
                out.write("The Kallithea front-end was built using the following Node modules:\n\n")
 
                for name_version, values in sorted(rows.items()):
 
                    name, version = name_version.rsplit('@', 1)
 
                    line = "%s from https://www.npmjs.com/package/%s/v/%s\n  License: %s\n  Repository: %s\n" % (
 
                        name_version, name, version, values['licenses'], values.get('repository', '-'))
 
                    if values.get('copyright'):
 
                        line += "  Copyright: %s\n" % (values['copyright'])
 
                    out.write(line + '\n')
kallithea/public/fontello/css/kallithea.css
Show inline comments
 
@charset "UTF-8";
 

	
 
 @font-face {
 
  font-family: 'kallithea';
 
  src: url('../font/kallithea.eot?96450582');
 
  src: url('../font/kallithea.eot?96450582#iefix') format('embedded-opentype'),
 
       url('../font/kallithea.woff2?96450582') format('woff2'),
 
       url('../font/kallithea.woff?96450582') format('woff'),
 
       url('../font/kallithea.ttf?96450582') format('truetype'),
 
       url('../font/kallithea.svg?96450582#kallithea') format('svg');
 
  /* NOTE: relative font paths have been adjusted to compensate for where the */
 
  /*       content of this CSS file ends up being used */
 
  src: url('../fontello/font/kallithea.eot?96450582');
 
  src: url('../fontello/font/kallithea.eot?96450582#iefix') format('embedded-opentype'),
 
       url('../fontello/font/kallithea.woff2?96450582') format('woff2'),
 
       url('../fontello/font/kallithea.woff?96450582') format('woff'),
 
       url('../fontello/font/kallithea.ttf?96450582') format('truetype'),
 
       url('../fontello/font/kallithea.svg?96450582#kallithea') format('svg');
 
  font-weight: normal;
 
  font-style: normal;
 
}
 
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
 
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
 
/*
 
@media screen and (-webkit-min-device-pixel-ratio:0) {
 
  @font-face {
 
    font-family: 'kallithea';
 
    src: url('../font/kallithea.svg?96450582#kallithea') format('svg');
 
    src: url('../fontello/font/kallithea.svg?96450582#kallithea') format('svg');
 
  }
 
}
 
*/
 
 
 
 [class^="icon-"]:before, [class*=" icon-"]:before {
 
  font-family: "kallithea";
 
  font-style: normal;
 
  font-weight: normal;
 
  speak: none;
 
 
 
  display: inline-block;
 
  text-decoration: inherit;
 
  width: 1em;
 
  margin-right: .2em;
 
  text-align: center;
 
  /* opacity: .8; */
 
 
 
  /* For safety - reset parent styles, that can break glyph codes*/
 
  font-variant: normal;
 
  text-transform: none;
 
 
 
  /* fix buttons height, for twitter bootstrap */
 
  line-height: 1em;
 
 
 
  /* Animation center compensation - margins should be symmetric */
 
  /* remove if not needed */
 
  margin-left: .2em;
 
 
 
  /* you can be more comfortable with increased icons size */
 
  /* font-size: 120%; */
 
 
 
  /* Font smoothing. That was taken from TWBS */
 
  -webkit-font-smoothing: antialiased;
 
  -moz-osx-font-smoothing: grayscale;
 
 
 
  /* Uncomment for 3D effect */
 
  /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
 
}
 
 
 
.icon-circle:before { content: '\2022'; } /* '•' */
 
.icon-right-open:before { content: '\2190'; } /* '←' */
 
.icon-up-open:before { content: '\2191'; } /* '↑' */
 
.icon-left-open:before { content: '\2192'; } /* '→' */
 
.icon-down-open:before { content: '\2193'; } /* '↓' */
 
.icon-code:before { content: '\2194'; } /* '↔' */
 
.icon-sort:before { content: '\2195'; } /* '↕' */
 
.icon-exchange:before { content: '\21c4'; } /* '⇄' */
 
.icon-plus-circled:before { content: '\2295'; } /* '⊕' */
 
.icon-minus-circled:before { content: '\2296'; } /* '⊖' */
 
.icon-diff-added:before { content: '\229e'; } /* '⊞' */
 
.icon-diff-removed:before { content: '\229f'; } /* '⊟' */
 
.icon-diff-modified:before { content: '\22a1'; } /* '⊡' */
 
.icon-clock:before { content: '\231a'; } /* '⌚' */
 
.icon-triangle-left:before { content: '\23f4'; } /* '⏴' */
 
.icon-triangle-right:before { content: '\23f5'; } /* '⏵' */
 
.icon-triangle-up:before { content: '\23f6'; } /* '⏶' */
 
.icon-triangle-down:before { content: '\23f7'; } /* '⏷' */
 
.icon-circle-empty:before { content: '\25e6'; } /* '◦' */
 
.icon-heart-empty:before { content: '\2661'; } /* '♡' */
 
.icon-heart:before { content: '\2665'; } /* '♥' */
 
.icon-cog-alt:before { content: '\2699'; } /* '⚙' */
 
.icon-database:before { content: '\26c3'; } /* '⛃' */
 
.icon-gear:before { content: '\26ed'; } /* '⛭' */
 
.icon-plus:before { content: '\2795'; } /* '➕' */
 
.icon-minus:before { content: '\2796'; } /* '➖' */
 
.icon-resize-vertical:before { content: '\2b65'; } /* '⭥' */
 
.icon-move-up:before { content: '\2b71'; } /* '⭱' */
 
.icon-move-down:before { content: '\2b73'; } /* '⭳' */
 
.icon-file-submodule:before { content: '\e801'; } /* '' */
 
.icon-git-merge:before { content: '\e802'; } /* '' */
 
.icon-ruler:before { content: '\e811'; } /* '' */
 
.icon-download-cloud:before { content: '\e813'; } /* '' */
 
.icon-upload-cloud:before { content: '\e814'; } /* '' */
 
.icon-graph:before { content: '\e815'; } /* '' */
 
.icon-file-zip:before { content: '\e816'; } /* '' */
 
.icon-file-code:before { content: '\e81a'; } /* '' */
 
.icon-doc-text-inv:before { content: '\e81c'; } /* '' */
 
.icon-diff:before { content: '\e81d'; } /* '' */
 
.icon-diff-ignored:before { content: '\e81e'; } /* '' */
 
.icon-diff-renamed:before { content: '\e81f'; } /* '' */
 
.icon-paste:before { content: '\e820'; } /* '' */
 
.icon-file-directory:before { content: '\e823'; } /* '' */
 
.icon-git-compare:before { content: '\e824'; } /* '' */
 
.icon-git-pull-request:before { content: '\e825'; } /* '' */
 
.icon-repo-forked:before { content: '\e827'; } /* '' */
 
.icon-fork:before { content: '\e828'; } /* '' */
 
.icon-docs:before { content: '\e834'; } /* '' */
 
.icon-doc-inv:before { content: '\e836'; } /* '' */
 
.icon-file-powerpoint:before { content: '\e837'; } /* '' */
 
.icon-tags:before { content: '\e83d'; } /* '' */
 
.icon-bookmark-empty:before { content: '\e83f'; } /* '' */
 
.icon-bookmark:before { content: '\e840'; } /* '' */
 
.icon-align-left:before { content: '\e841'; } /* '' */
 
.icon-sliders:before { content: '\e843'; } /* '' */
 
.icon-eye-off:before { content: '\e851'; } /* '' */
 
.icon-rss:before { content: '\e855'; } /* '' */
kallithea/public/less/kallithea-variables.less
Show inline comments
 
/* basic variables */
 
@kallithea-theme-main-color:        #577632;
 
@kallithea-theme-inverse-color:     #FFF;
 
@kallithea-theme-inverse-bg:        @kallithea-theme-main-color;
 
@kallithea-panel-margin:            10px;
 

	
 
/* logo */
 
@kallithea-logo-url:                "../images/kallithea-logo.svg";
 
@kallithea-logo-width:              140px;
 
@kallithea-logo-height:             30px;
 
@kallithea-logo-bottom:             4px;
 

	
 
/* bootstrap override */
 
@brand-primary:                     @kallithea-theme-main-color;
 
@link-hover-color:                  darken(@kallithea-theme-main-color, 20.0%);
 
@btn-default-bg:                    #E7E7E7;
 
@font-family-monospace:             Lucida Console, Consolas, Monaco, Inconsolata, Liberation Mono, monospace;
 
@navbar-height:                     36px;
 
@navbar-margin-bottom:              @kallithea-panel-margin;
 
@navbar-inverse-color:              @kallithea-theme-inverse-color;
 
@navbar-inverse-bg:                 @kallithea-theme-inverse-bg;
 
@navbar-inverse-border:             @kallithea-theme-inverse-bg;
 
@navbar-inverse-link-color:         @kallithea-theme-inverse-color;
 
@navbar-inverse-link-hover-color:   tint(@kallithea-theme-inverse-color, 15.0%);
 
@navbar-inverse-link-hover-bg:      tint(@kallithea-theme-inverse-bg, 15.0%);
 
@navbar-inverse-link-active-color:  @navbar-inverse-link-hover-color;
 
@navbar-inverse-link-active-bg:     @navbar-inverse-link-hover-bg;
 
@navbar-inverse-toggle-hover-bg:    @navbar-inverse-link-hover-bg;
 
@navbar-inverse-toggle-border-color:@kallithea-theme-inverse-bg;
 
@nav-pills-active-link-hover-color: @navbar-inverse-color;
 
@nav-pills-active-link-hover-bg:    @navbar-inverse-bg;
 
@nav-link-padding:                  8px 10px; /* default: 10px 15px */
 
@dropdown-link-color:               @navbar-inverse-color;
 
@dropdown-bg:                       @navbar-inverse-bg;
 
@dropdown-link-hover-color:         @navbar-inverse-link-hover-color;
 
@dropdown-link-hover-bg:            @navbar-inverse-link-hover-bg;
 
@grid-gutter-width:                 2 * @kallithea-panel-margin; /* default: 30px */
 
@panel-heading-padding:             5px 15px; /* default: 10px 15px */
 
@panel-primary-text:                @kallithea-theme-inverse-color;
 
@panel-primary-heading-bg:          @kallithea-theme-inverse-bg;
 
@panel-primary-border:              @panel-primary-heading-bg;
 
@headings-font-weight:              700;
 
@table-cell-padding:                2px 4px;
 
@icon-font-path:                    ; /* no glyphicons */
 
@icon-font-name:                    none;
 

	
 
/* custom variables */
 
@highlight-color:                   #FAFFA6;
 
@highlight-line-color:              #DDE7EF;
 
@add-bg-color:                      #BBFFBB;
 
@change-bg-color:                   #DDDDDD;
 
@delete-bg-color:                   #FF8888;
0 comments (0 inline, 0 general)