Update npm packages, remove grunt, lint css, add print styles

This commit is contained in:
Stéphane Goetz 2016-08-06 00:14:15 +02:00
parent 57f3111a97
commit 80d4646b2d
22 changed files with 127 additions and 158 deletions

View File

@ -1,20 +0,0 @@
module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-php');
grunt.initConfig({
php: {
dist: {
options: {
keepalive: true,
open: true,
port: 8085,
router: "index.php"
}
}
}
});
grunt.registerTask('default', ['php']);
};

View File

@ -1,11 +1,11 @@
var cssnano = require('cssnano'),
var gulp = require('gulp'), gulp = require('gulp'),
php = require('gulp-connect-php'),
less = require('gulp-less'), less = require('gulp-less'),
rename = require('gulp-rename'), rename = require('gulp-rename'),
plumber = require('gulp-plumber'), plumber = require('gulp-plumber'),
postcss = require('gulp-postcss'), postcss = require('gulp-postcss'),
sourcemaps = require('gulp-sourcemaps'); sourcemaps = require('gulp-sourcemaps'),
stylelint = require('gulp-stylelint');
var resources = { var resources = {
daux_blue:{source: "themes/daux/less/theme-blue.less", dest: "themes/daux/css/"}, daux_blue:{source: "themes/daux/less/theme-blue.less", dest: "themes/daux/css/"},
@ -16,93 +16,76 @@ var resources = {
daux_singlepage:{source: "themes/daux_singlepage/less/main.less", dest: "themes/daux_singlepage/css/"} daux_singlepage:{source: "themes/daux_singlepage/less/main.less", dest: "themes/daux_singlepage/css/"}
}; };
function createTask(source, dest) { var stylelintRules = {
return function() { "indentation": 4,
var nano_options = { "selector-list-comma-newline-after": "always-multi-line",
safe: true, // Disable dangerous optimisations "selector-no-id": true,
filterPlugins: false, // This does very weird stuff
autoprefixer: { // Autoprefixer
add: true, // Add needed prefixes "at-rule-no-vendor-prefix": true,
remove: true // Remove unnecessary prefixes "media-feature-name-no-vendor-prefix": true,
} "property-no-vendor-prefix": true,
}; "selector-no-vendor-prefix": true,
"value-no-vendor-prefix": true
};
var cssnanoOptions = {
safe: true, // Disable dangerous optimisations
filterPlugins: false, // This does very weird stuff
autoprefixer: {
add: true, // Add needed prefixes
remove: true // Remove unnecessary prefixes
}
};
function createCSSTask(source, dest) {
return function () {
return gulp.src(source) return gulp.src(source)
//.pipe(sourcemaps.init()) //.pipe(sourcemaps.init())
.pipe(plumber()) .pipe(plumber())
.pipe(less()) .pipe(less())
.pipe(postcss([ .pipe(postcss([cssnano(cssnanoOptions)]))
require('cssnano')(nano_options)
]))
.pipe(rename({suffix: '.min'})) .pipe(rename({suffix: '.min'}))
//.pipe(sourcemaps.write()) //.pipe(sourcemaps.write())
.pipe(gulp.dest(dest)); .pipe(gulp.dest(dest));
} }
} }
gulp.task('lint-css', function () {
function createLinter() {
var gulpStylelint = require('gulp-stylelint');
var rules = {
"indentation": 4,
"selector-list-comma-newline-after": "always-multi-line",
"selector-no-id": true,
// Autoprefixer
"at-rule-no-vendor-prefix": true,
"media-feature-name-no-vendor-prefix": true,
"property-no-vendor-prefix": true,
"selector-no-vendor-prefix": true,
"value-no-vendor-prefix": true
};
return gulp return gulp
.src(['themes/**/less/**/*.less', '!themes/**/vendor/**/*.less']) .src(['themes/**/less/**/*.less', '!themes/**/vendor/**/*.less'])
.pipe(gulpStylelint({ .pipe(stylelint({
failAfterError: true, failAfterError: true,
config: { config: {
extends: "stylelint-config-standard", extends: 'stylelint-config-standard',
rules: rules rules: stylelintRules
}, },
syntax: "less", syntax: 'less',
reporters: [ reporters: [{
{formatter: 'string', console: true} formatter: 'string',
], console: true
}],
debug: true debug: true
})); }));
} });
var style_tasks = []; var style_tasks = [];
for (var style in resources) { for (var style in resources) {
if (resources.hasOwnProperty(style)) { if (resources.hasOwnProperty(style)) {
gulp.task('style_' + style, createTask(resources[style].source, resources[style].dest)); gulp.task('style_' + style, createCSSTask(resources[style].source, resources[style].dest));
style_tasks.push('style_' + style); style_tasks.push('style_' + style);
} }
} }
gulp.task('lint-css', createLinter);
style_tasks.push('lint-css'); style_tasks.push('lint-css');
gulp.task("styles", style_tasks); gulp.task("styles", style_tasks);
gulp.task('watch', function () {
gulp.task('watch', function() {
// Watch .less files // Watch .less files
gulp.watch('themes/**/less/**/*.less', ['styles']); gulp.watch('themes/**/less/**/*.less', ['styles']);
}); });
gulp.task('php', function() { gulp.task('default', ['styles']);
php.server({
keepalive: true,
open: true,
port: 8085,
router: "index.php"
});
});
gulp.task('default', ['php']);

View File

@ -1,19 +1,16 @@
{ {
"name": "daux.io", "name": "daux.io",
"version": "0.1.1", "version": "0.3.0",
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"cssnano": "^3.5.2", "cssnano": "^3.7.3",
"grunt": "^0.4.1",
"grunt-php": "^1.0.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
"gulp-connect-php": "^0.0.7", "gulp-less": "^3.1.0",
"gulp-less": "^3.0.3",
"gulp-plumber": "^1.1.0", "gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.1.0", "gulp-postcss": "^6.1.1",
"gulp-rename": "^1.2.2", "gulp-rename": "^1.2.2",
"gulp-sourcemaps": "^2.0.0-alpha", "gulp-sourcemaps": "^1.6.0",
"gulp-stylelint": "^2.0.2", "gulp-stylelint": "^3.0.0",
"stylelint-config-standard": "^6.0.0" "stylelint-config-standard": "^12.0.0"
} }
} }

View File

@ -7,11 +7,11 @@
} ?> } ?>
<div class="Navbar hidden-print"> <header class="Navbar hidden-print">
<?php $this->insert('theme::partials/navbar_content', ['params' => $params]); ?> <?php $this->insert('theme::partials/navbar_content', ['params' => $params]); ?>
</div> </header>
<div class="Columns content"> <div class="Columns content">
<div class="Columns__left hidden-print Collapsible"> <aside class="Columns__left Collapsible">
<div class="Collapsible__container"> <div class="Collapsible__container">
<button type="button" class="Button Collapsible__trigger"> <button type="button" class="Button Collapsible__trigger">
<span class="Collapsible__trigger--bar"></span> <span class="Collapsible__trigger--bar"></span>
@ -93,12 +93,8 @@
} ?> } ?>
</div> </div>
</div> </div>
<!-- For Mobile --> </aside>
</div>
<div class="Columns__right <?= $params['html']['float'] ? 'Columns__right--float' : ''; ?>"> <div class="Columns__right <?= $params['html']['float'] ? 'Columns__right--float' : ''; ?>">
<div class="Columns__right__content"> <div class="Columns__right__content">
<div class="doc_content"> <div class="doc_content">
<?= $this->section('content'); ?> <?= $this->section('content'); ?>

View File

@ -6,34 +6,40 @@
box-shadow: none !important; box-shadow: none !important;
} }
.page-break { h1, h2, h3, h4, h5, h6 {
display: block;
page-break-before: always;
}
h1, h2 {
page-break-after: avoid; page-break-after: avoid;
page-break-before: auto; page-break-before: auto;
} }
pre, blockquote { pre, blockquote {
border: 1px solid #999; border: 1px solid #999;
font-style: italic;
page-break-inside: avoid; page-break-inside: avoid;
} }
img { img {
page-break-inside: avoid; page-break-inside: avoid;
border: 0; /* Some browsers like to show a border around images. Switch it off */
} }
a, a,
a:visited { a:visited { text-decoration: underline; }
text-decoration: underline;
abbr[title]::after { content: " (" attr(title) ")"; }
q { quotes: none; }
q::before { content: ""; }
q::after { content: " (" attr(cite) ")"; }
.page-break {
display: block;
page-break-before: always;
} }
a[href]::after { .hidden-print { display: none; }
content: " (" attr(href) ")";
} /* Hide the navigation */
aside { display: none; }
abbr[title]::after {
content: " (" attr(title) ")";
}

View File

@ -6,7 +6,6 @@ h1, h2, h3, h4, h5, h6 {
font-weight: 300; font-weight: 300;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
cursor: text; cursor: text;
line-height: 1.4em; line-height: 1.4em;
margin-top: 0.3em; margin-top: 0.3em;
margin-bottom: 0.3em; margin-bottom: 0.3em;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -87,6 +87,7 @@ Components
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
&:first-child { &:first-child {
margin-left: 0; margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) { &:not(:last-child):not(.dropdown-toggle) {
.border-right-radius(0); .border-right-radius(0);
} }
@ -111,10 +112,8 @@ Components
font-size: 18px; font-size: 18px;
line-height: 20px; line-height: 20px;
height: @navbar-height; height: @navbar-height;
color: @light; color: @light;
text-shadow: none; text-shadow: none;
font-family: @font-family-heading; font-family: @font-family-heading;
font-weight: 700; font-weight: 700;
} }
@ -225,7 +224,7 @@ Components
} }
.Page__header { .Page__header {
margin: 0 0 10px 0; margin: 0 0 10px;
padding: 0; padding: 0;
border-bottom: 1px solid #eee; border-bottom: 1px solid #eee;
@ -267,14 +266,12 @@ Components
position: relative; position: relative;
float: right; float: right;
margin: 8px 20px; margin: 8px 20px;
vertical-align: middle;
&__field { &__field {
display: block; display: block;
width: 100%; width: 100%;
height: 34px; height: 34px;
padding: 6px 30px 6px 0; padding: 6px 30px 6px 0;
color: #555; color: #555;
background: #fff; background: #fff;
border: 1px solid #ccc; border: 1px solid #ccc;
@ -293,7 +290,6 @@ Components
position: absolute; position: absolute;
right: 9px; right: 9px;
top: 9px; top: 9px;
width: 16px; width: 16px;
height: 16px; height: 16px;
} }
@ -332,7 +328,6 @@ Components
> a { > a {
display: inline-block; display: inline-block;
padding: 5px 14px; padding: 5px 14px;
background-color: #fff; background-color: #fff;
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 15px; border-radius: 15px;

View File

@ -39,13 +39,14 @@ Homepage
.Homepage { .Homepage {
padding-top: 60px !important; padding-top: 60px !important;
background-color: @light; background-color: @light;
.kill-box-shadow;
border-radius: 0; border-radius: 0;
border: none; border: none;
color: @dark; color: @dark;
overflow: hidden; overflow: hidden;
padding-bottom: 0; padding-bottom: 0;
margin-bottom: 0; margin-bottom: 0;
.kill-box-shadow;
} }
.HomepageTitle { .HomepageTitle {
@ -73,19 +74,18 @@ Homepage
.Button--hero { .Button--hero {
padding: 20px 30px; padding: 20px 30px;
.kill-background-image;
.kill-box-shadow;
border-radius: 0; border-radius: 0;
text-shadow: none; text-shadow: none;
border: none;
opacity: 0.8; opacity: 0.8;
margin: 0 10px; margin: 0 10px;
text-transform: uppercase; text-transform: uppercase;
border: 5px solid @dark; border: 5px solid @dark;
font-family: @font-family-heading; font-family: @font-family-heading;
font-weight: 700; font-weight: 700;
.kill-background-image;
.kill-box-shadow;
@media (max-width: 768px) { @media (max-width: 768px) {
display: block; display: block;
margin-bottom: 10px; margin-bottom: 10px;
@ -119,7 +119,6 @@ Homepage
.col-third { .col-third {
width: 33.333333%; width: 33.333333%;
float: left; float: left;
position: relative; position: relative;
min-height: 1px; min-height: 1px;
padding-left: 15px; padding-left: 15px;
@ -164,11 +163,12 @@ Homepage
.HomepageFooter { .HomepageFooter {
background-color: @dark; background-color: @dark;
.kill-box-shadow;
border-radius: 0; border-radius: 0;
color: @light; color: @light;
border: none; border: none;
.kill-box-shadow;
@media (max-width: 768px) { @media (max-width: 768px) {
padding: 0 20px; padding: 0 20px;
text-align: center; text-align: center;
@ -195,7 +195,6 @@ Homepage
li { li {
a { a {
line-height: 32px; line-height: 32px;
font-size: 16px; font-size: 16px;
font-family: @font-family-heading; font-family: @font-family-heading;
font-weight: 700; font-weight: 700;

View File

@ -55,6 +55,7 @@ Mixins
content: " "; // 1 content: " "; // 1
display: table; // 2 display: table; // 2
} }
&::after { &::after {
clear: both; clear: both;
} }

View File

@ -0,0 +1,20 @@
@import "../../common/less/_print.less";
.Pager { display: none; }
.Columns__right {
width: 100% !important;
}
.s-content a::after {
content: " (" attr(href) ")";
font-size: 80%;
word-wrap: break-word; /* break long urls that donìt fit the page width */
}
/* Anchors don't need that */
.s-content a[href^="#"]::after { content: ""; }
h1 a[href]::after {
font-size: 50%;
}

View File

@ -46,11 +46,12 @@ html, body {
&__trigger { &__trigger {
padding: 7px 10px; padding: 7px 10px;
.kill-background-image;
.kill-box-shadow;
background-color: @sidebar-hover; background-color: @sidebar-hover;
border: none; border: none;
.kill-background-image;
.kill-box-shadow;
&--bar { &--bar {
display: block; display: block;
width: 18px; width: 18px;
@ -62,8 +63,8 @@ html, body {
} }
&:hover { &:hover {
.kill-box-shadow;
background-color: @dark; background-color: @dark;
.kill-box-shadow;
.icon-bar { .icon-bar {
background-color: @light; background-color: @light;
@ -74,7 +75,6 @@ html, body {
} }
@media screen and (min-width: 768px) { @media screen and (min-width: 768px) {
body { body {
//Needed only for floating code blocks //Needed only for floating code blocks
background-color: @light; background-color: @light;
@ -126,6 +126,7 @@ html, body {
&__right { &__right {
width: 75%; width: 75%;
&__content { &__content {
padding: 20px; padding: 20px;
min-height: 100%; min-height: 100%;
@ -133,17 +134,3 @@ html, body {
} }
} }
} }
@media print {
.Columns__right {
width: 100% !important;
}
h1 a[href]::after {
font-size: 50%;
}
.hidden-print {
display: none;
}
}

View File

@ -6,7 +6,6 @@ body {
font-family: @font-family-text; font-family: @font-family-text;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
font-smoothing: antialiased; font-smoothing: antialiased;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
} }
@ -123,7 +122,7 @@ h1, h2, h3, h4, h5, h6 {
width: 50%; width: 50%;
border: none; border: none;
border-left: 10px solid white; border-left: 10px solid white;
margin: 0 0 10px 0; margin: 0 0 10px;
padding: 0; padding: 0;
code { code {

View File

@ -18,3 +18,7 @@
@import "_components.less"; @import "_components.less";
@import "_homepage.less"; @import "_homepage.less";
@import "../../common/less/vendor/highlight.less"; @import "../../common/less/vendor/highlight.less";
@media print {
@import "_print.less";
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
@import "../../common/less/_print.less";
a[href]::after {
content: " (" attr(href) ")";
}

View File

@ -1,8 +1,7 @@
// Core variables and mixins // Core variables and mixins
@import "variables.less";
@import "../../common/less/_fonts.less"; @import "../../common/less/_fonts.less";
@import "vendor/highlight.less"; @import "vendor/highlight.less";
@import "typography.less"; @import "_typography.less";
* { * {
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
@ -55,5 +54,5 @@ img {
} }
@media print { @media print {
@import "print.less"; @import "_print.less";
} }

View File

@ -1,2 +0,0 @@