Skip to content

Commit

Permalink
fix(*): styles and versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandyr committed May 27, 2021
1 parent 0ffd62a commit 864495c
Show file tree
Hide file tree
Showing 21 changed files with 1,203 additions and 3,526 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[package.json]
indent_size = 2
3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 8
}
55 changes: 55 additions & 0 deletions InlineAssetsPlugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
class InlineAssetsPlugin {
constructor(options = {}) {
const { patterns = [] } = options;
this.patterns = patterns;
}

apply(compiler) {
compiler.hooks.emit.tapAsync(
"InlineAssetsPlugin",
(compilation, callback) => {
for (const pattern of this.patterns) {
const fromSource = this.getSource(
compilation.getAsset(pattern.from)
);
const toSource = this.getSource(
compilation.getAsset(pattern.to)
);

const resultSource = toSource.replace(
pattern.pattern,
fromSource
);

compilation.updateAsset(pattern.to, {
source() {
return resultSource;
},
size() {
return resultSource.length;
},
});
}

callback();
}
);
}

getSource(asset) {
let source = asset.source;
if (typeof source === "function") {
source = source();
} else {
source = source.source();
}

if (source instanceof Buffer) {
return source.toString("utf8");
}

return source;
}
}

module.exports.InlineAssetsPlugin = InlineAssetsPlugin;
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# ig-typedoc-theme
# igniteui-typedoc-theme
![Build Status](https://travis-ci.org/IgniteUI/igniteui-typedoc-theme.svg?branch=master)

This package extends [igniteui-typedoc-theme](https://github.com/IgniteUI/igniteui-typedoc-theme) and represents the feel and look of the infragistics API **EN** and **JP** typedoc documentations.
This package represents the feel and look of the infragistics API typedoc documentations.
There are a specific global header and footer declarations that could be easily edited based on user's preferences.

It includes specific internationalization configurations and depends on the [typedoc plugin](https://github.com/IgniteUI/typedoc-plugin-localization) package.
The output of the theme could be seen on [this web app](https://www.infragistics.com/products/ignite-ui-angular/docs/typescript/latest/)

The output of the theme could be seen on:
* [EN API web app](https://www.infragistics.com/products/ignite-ui-angular/docs/typescript/latest/)
* [JP API web app](https://jp.infragistics.com/products/ignite-ui-angular/docs/typescript/latest/)
Example: This theme is used by other documentations within (or external) of the Infragistics organization - e.g. Reveal API documentation. Using of the theme externaly is also possible.
32 changes: 13 additions & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ const path = require('path');
const slash = require('slash');
const ts = require('gulp-typescript');
const { series } = require('gulp');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const sass = require('gulp-sass');
const concat = require('gulp-concat');

const TYPEDOC_THEME = {
SRC: slash(path.join(__dirname, 'src')),
Expand All @@ -21,7 +18,6 @@ const TYPEDOC_THEME = {
}
};


const typedocBuildThemeTS = () => {
return src(
slash(path.join(__dirname, 'src', 'assets', 'js', 'src', 'theme.ts'))
Expand All @@ -46,19 +42,17 @@ const buildHelpers = () => {
.pipe(dest(slash(path.join(__dirname, 'dist', 'helpers'))));
};

const typedocCopyStyles = () => {
const prefixer = postcss([autoprefixer({
overrideBrowserslist: ['last 5 versions', '> 3%'],
cascade: false,
grid: false
})]);
const typedocMinifyJS = (cb) => {
src([
slash(path.join(TYPEDOC_THEME.SRC, 'assets','js', 'src', 'navigation/igviewer.common.js')),
slash(path.join(TYPEDOC_THEME.SRC, 'assets','js', 'src', 'navigation/igviewer.renderingService.js')),
slash(path.join(TYPEDOC_THEME.SRC, 'assets','js', 'src', 'navigation/nav-initializer.js')),
slash(path.join(TYPEDOC_THEME.SRC, 'assets','js', 'src', 'versioning/tag-versions.req.js'))
])
.pipe(concat('nav-and-versioning.js'))
.pipe(dest(slash(path.join(TYPEDOC_THEME.DIST, 'assets', 'js'))));

return src(slash(path.join(TYPEDOC_THEME.SRC, TYPEDOC_THEME.STYLES.ENTRY)))
.pipe(sourcemaps.init())
.pipe(sass.sync(TYPEDOC_THEME.STYLES.CONFIG).on('error', sass.logError))
.pipe(prefixer)
.pipe(sourcemaps.write('./'))
.pipe(dest(slash(path.join(TYPEDOC_THEME.DIST, TYPEDOC_THEME.STYLES.OUT))));
};
cb();
};

module.exports.buildTypedocTs = series(typedocBuildThemeTS, buildHelpers, typedocCopyStyles);
module.exports.buildTypedocTs = series(typedocBuildThemeTS, buildHelpers, typedocMinifyJS);
Loading

0 comments on commit 864495c

Please sign in to comment.