Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

docs-styles(build): Operationalize doc styles build #1897

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ plnkr.html
public/docs/*/latest/guide/cheatsheet.json
protractor-results.txt
link-checker-results.txt
*a2docs.css
32 changes: 23 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var globby = require("globby");
// - because childProcess.kill does not work properly on windows
var treeKill = require("tree-kill");
var blc = require("broken-link-checker");

var less = require('gulp-less');
var tslint = require('gulp-tslint');

// TODO:
Expand All @@ -41,6 +41,7 @@ var EXAMPLES_PROTRACTOR_PATH = path.join(EXAMPLES_PATH, '_protractor');
var NOT_API_DOCS_GLOB = path.join(PUBLIC_PATH, './{docs/*/latest/!(api),!(docs)}/**/*.*');
var RESOURCES_PATH = path.join(PUBLIC_PATH, 'resources');
var LIVE_EXAMPLES_PATH = path.join(RESOURCES_PATH, 'live-examples');
var STYLES_SOURCE_PATH = path.join(TOOLS_PATH, 'styles-builder/less');

var docShredder = require(path.resolve(TOOLS_PATH, 'doc-shredder/doc-shredder'));
var exampleZipper = require(path.resolve(TOOLS_PATH, '_example-zipper/exampleZipper'));
Expand Down Expand Up @@ -87,6 +88,7 @@ var _excludeMatchers = _excludePatterns.map(function(excludePattern){

var _exampleBoilerplateFiles = [
'.editorconfig',
'a2docs.css',
'karma.conf.js',
'karma-test-shim.js',
'package.json',
Expand All @@ -98,14 +100,16 @@ var _exampleBoilerplateFiles = [
'wallaby.js'
];

var _exampleDartWebBoilerPlateFiles = ['styles.css'];
var _exampleDartWebBoilerPlateFiles = ['a2docs.css', 'styles.css'];

var _exampleProtractorBoilerplateFiles = [
'tsconfig.json'
];

var _exampleConfigFilename = 'example-config.json';

var _styleLessName = 'a2docs.less';

// Gulp flags:
//
// --lang=[all | ts | js | dart | (ts|js) | (ts|js|dart) | ...]
Expand All @@ -117,7 +121,7 @@ var _exampleConfigFilename = 'example-config.json';
var lang, langs, buildDartApiDocs = false;
function configLangs(langOption) {
const fullSiteBuildTasks = ['build-compile', 'check-serve', 'check-deploy'];
const buildAllDocs = argv['_'] &&
const buildAllDocs = argv['_'] &&
fullSiteBuildTasks.some((task) => argv['_'].indexOf(task) >= 0);
const langDefault = buildAllDocs ? 'all' : '(ts|js)';
lang = (langOption || langDefault).toLowerCase();
Expand Down Expand Up @@ -191,7 +195,7 @@ function runE2e() {
return spawnInfo.promise;
})
.then(function() {
copyExampleBoilerplate();
buildStyles(copyExampleBoilerplate, _.noop);
gutil.log('runE2e: update webdriver');
spawnInfo = spawnExt('npm', ['run', 'webdriver:update'], {cwd: EXAMPLES_PROTRACTOR_PATH});
return spawnInfo.promise;
Expand Down Expand Up @@ -415,7 +419,7 @@ gulp.task('help', taskListing.withFilters(function(taskName) {
}));

// requires admin access because it adds symlinks
gulp.task('add-example-boilerplate', function() {
gulp.task('add-example-boilerplate', function(done) {
var realPath = path.join(EXAMPLES_PATH, '/node_modules');
var nodeModulesPaths = excludeDartPaths(getNodeModulesPaths(EXAMPLES_PATH));

Expand All @@ -431,16 +435,26 @@ gulp.task('add-example-boilerplate', function() {
fsUtils.addSymlink(realPath, linkPath);
});

return copyExampleBoilerplate();
return buildStyles(copyExampleBoilerplate, done);
});


// copies boilerplate files to locations
// where an example app is found
gulp.task('_copy-example-boilerplate', function () {
if (!argv.fast) copyExampleBoilerplate();
gulp.task('_copy-example-boilerplate', function (done) {
if (!argv.fast) buildStyles(copyExampleBoilerplate, done);
});

//Builds Angular 2 Docs CSS file from Bootstrap npm LESS source
//and copies the result to the _examples folder to be included as
//part of the example boilerplate.
function buildStyles(cb, done){
gulp.src(path.join(STYLES_SOURCE_PATH, _styleLessName))
.pipe(less())
.pipe(gulp.dest(EXAMPLES_PATH)).on('end', function(){
cb().then(function() { done(); });
});
}

// copies boilerplate files to locations
// where an example app is found
Expand Down Expand Up @@ -1244,7 +1258,7 @@ function buildApiDocsForDart() {
dab.createApiDataAndJadeFiles(apiEntries);

}).catch((err) => {
console.log(err);
console.log(err);
});

} catch(err) {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"devDependencies": {
"archiver": "^1.0.0",
"assert-plus": "^1.0.0",
"bootstrap": "3.3.6",
"broken-link-checker": "0.7.1",
"browser-sync": "^2.9.3",
"canonical-path": "0.0.2",
Expand All @@ -43,6 +44,7 @@
"gulp": "^3.5.6",
"gulp-env": "0.4.0",
"gulp-sass": "^2.3.2",
"gulp-less": "^3.1.0",
"gulp-task-listing": "^1.0.1",
"gulp-tslint": "^5.0.0",
"gulp-util": "^3.0.6",
Expand Down
29 changes: 29 additions & 0 deletions tools/styles-builder/less/a2docs.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//Import angular 2 docs colors and mixins
@import './colors/docs-material-palette.colors.less';
@import './mixins/docs.mixins.less';
//Import Bootstrap scaffolding and variables
@import '../../../node_modules/bootstrap/less/scaffolding.less';
@import '../../../node_modules/bootstrap/less/variables.less';
//Override Bootstrap variables with custom values for angular 2 docs
@import './overrides/bootstrap.overrides.less';
//Import Bootstrap layout systems
@import '../../../node_modules/bootstrap/less/mixins.less';
@import '../../../node_modules/bootstrap/less/grid.less';
@import '../../../node_modules/bootstrap/less/utilities.less';
@import '../../../node_modules/bootstrap/less/responsive-utilities.less';
//Import only Bootstrap elements to support angular 2 docs styles
@import '../../../node_modules/bootstrap/less/type.less';
@import '../../../node_modules/bootstrap/less/forms.less';
@import '../../../node_modules/bootstrap/less/buttons.less';
@import '../../../node_modules/bootstrap/less/button-groups.less';
@import '../../../node_modules/bootstrap/less/input-groups.less';
@import '../../../node_modules/bootstrap/less/tables.less';
@import '../../../node_modules/bootstrap/less/glyphicons.less';
@import '../../../node_modules/bootstrap/less/alerts.less';
@import '../../../node_modules/bootstrap/less/close.less';
//Import opacity overrides
@import './overrides/docs.opacity.overrides.less';
//Import styles overrides and angular 2 doc styles layouts
@import './overrides/docs.overrides.less';
//Import accessibility tweaks
@import './overrides/docs.a11y.overrides.less';
10 changes: 10 additions & 0 deletions tools/styles-builder/less/colors/docs-material-palette.colors.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//Style guide colors
@material-header: #455A64;
@material-header-darker: #37474F;
@material-header-dark: #263238;
@material-200: #EEEEEE;
@material-700: #616161;
@material-800: #424242;
@material-900: #212121;
@black: #000000;
@white: #FFFFFF;
44 changes: 44 additions & 0 deletions tools/styles-builder/less/mixins/docs.mixins.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.opacity(){
opacity: 0.87;
}

.top-header-text(){
font-size: 50px;
font-weight: bold;
}

.header-text(){
font-size: 30px;
font-weight: bold;
}

.sub-header-text(){
font-size: 20px;
font-weight: 400;
line-height: 40px;
}

.paragraph-text(){
font-size: 16px;
font-weight: 400;
line-height: 28px;
}

.label-text(){
font-size: 16px;
font-weight: 400;
line-height: 28px;
}

.button-text(){
font-size: 16px;
font-weight: bold;
line-height: 28px;
}

.input-text(){
font-size: 16px;
font-weight: 400;
line-height: 28px;
margin-top: 15px;
}
21 changes: 21 additions & 0 deletions tools/styles-builder/less/overrides/bootstrap.overrides.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//Main Bootstrap color overrides
@gray-base: @black;
@gray-darker: @black;
@gray-dark: @material-900;
@gray: @material-800;
@gray-light: @material-700;
@gray-lighter: @material-200;

//Font override
@font-family-sans-serif: "Roboto", Helvetica, Sans-Serif;

//Glyphicons font path
@icon-font-path: "./node_modules/bootstrap/fonts/";

//Class overrides
@input-color: @gray-dark;
@text-color: @gray-dark;
@btn-primary-color: @gray-lighter;
@btn-primary-bg: @material-header-dark;
@btn-default-color: @white;
@btn-default-bg: @material-header-darker;
55 changes: 55 additions & 0 deletions tools/styles-builder/less/overrides/docs.a11y.overrides.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//Accessibility tweaks
@danger-text: #632827;
@state-danger-text: @danger-text;

input {
&::-webkit-input-placeholder {
color: @gray-light !important;
}

&::-moz-placeholder {
color: @gray-light !important;
}
}

label {
input, textarea, select {
font-weight: normal;
}
}

button.btn.disabled,
button.btn[disabled] {
color: @white;
background-color: @black;
}

.btn.btn-primary:not(.disabled):not([disabled]) {
&:hover,
&:focus{
color: @black;
background-color: @gray-lighter;
}
}

.btn.btn-default:not(.disabled):not([disabled]) {
&:hover,
&:focus{
color: @black;
background-color: @gray-lighter;
}
}

button.btn.disabled, button.btn[disabled] {
&:hover,
&:focus{
color: @white;
background-color: @black;
}
}

.close,
.close:hover,
.close:focus{
opacity: 1;
}
35 changes: 35 additions & 0 deletions tools/styles-builder/less/overrides/docs.opacity.overrides.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//Opacity tweaks

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
.opacity();
}

label {

input {
opacity: 1;
}

.opacity();
}


input {
.opacity();
}

.label-default {
.opacity();
}

legend {
.opacity();
}

button {
.opacity();
}

span, p, dl {
.opacity();
}
Loading