Changelog
1.15.0 - 2019-08-06
[scripts][grunt][tasks] Added basic service worker with Network-first caching strategy, all related scripts and JSPM Grunt configuration. #384
[grunt] Added ability to exclude pages building by simply specifying _
in the beginning of the directory
Previously:
/templates/test/page.nj
— build/templates/_test/page.nj
— build/templates/test/_page.nj
— exclude/templates/_test/_page.nj
— excludeWith update:
/templates/test/page.nj
— build/templates/_test/page.nj
— exclude/templates/test/_page.nj
— exclude/templates/_test/_page.nj
— exclude[templates] Google Global Tag (Google Analytics) and Yandex Metrica will now track app version by default (note that Google Global Tag requires additional configuration of dimension in admin panel).
[static][templates] Added favicon-16x16.png
and favicon-32x32.png
. Some browsers like Chrome refusing to use favicon.ico
in their stead.
[package] Added NPM scripts lint:scripts
and lint:styles
to quickly invoke linting of scripts or styles-only.
[configs] Forced standard
to lint jsx
files too.
[modules] Added new tcomb
refinements:
MsDate
— expect timestamp in msDigitString
— expect strings with digits onlyEmail
— expect valid email[modules] Grunt task writeJSON
now allow to compile into json
file or into js
file with ES6 exports (which allows it to be effectively destructured and tree shacked).
[tests] Added better Jest watch experience with jest-watch-typeahead
.
[package] Updated dependencies:
autoprefixer
to 9.6.1
babel-eslint
to 10.0.2
gettext-parser
to 4.0.1
grunt-contrib-clean
to 2.0.0
grunt-contrib-htmlmin
to 3.1.0
grunt-csso
to 2.2.4
grunt-sass
to 3.0.2
grunt-spritesmith
to 6.7.1
grunt-uncss
to 0.8.6
grunt-webfont
to 1.7.2
grunt
to 1.0.4
hash-sum
to 2.0.0
jest
to 24.8.0
lodash
to 4.17.15
lru-cache
to 5.1.1
markdown-it
to 9.0.1
numbro
to 2.1.2
onecolor
to 3.1.0
snazzy
to 8.0.0
sprintf-js
to 1.1.2
standard
to 13.1.0
stylelint-config-standard
to 18.3.0
stylelint-scss
to 3.9.3
stylelint
to 10.1.0
time-grunt
to 2.0.0
[submodule] Updated Ekzo to 2.7.1
which included fixes of the linting errors.
[templates] Replace Google Analytics with newer Google Global Tag.
[templates] Replace Yandex Metrica with v2.
[scripts] Improved logging of the site info to the console:
- Kotsu v1.10.0 #23, SHA1 e9e5043d16df6d8f03b4a328407a75d711182ebe
+ Kotsu v1.10.0+23.e9e5043d16df6d8f03b4a328407a75d711182ebe, production (staging)
[grunt] Changed tasks to Explicitly call clean:build
and clean:temp
instead of the generic clean
to avoid accidentally cleaning everything when users adds additional cleaning tasks.
[grunt] Styles sourcemaps are now preserved after build.
[grunt] Ensured CSS sourcemaps to be generated when using CCSO.
[grunt] Changed styles watcher to watch for all *.scss
files in source and temp directories instead of only styles
directory. That's nice addition for projects which prefer to group component's scripts and styles.
[grunt] Updated grunt-sass
task configuration to work with new implementation
option.
[grunt][data][configs] Precompile scripts data into ES6 JS file scripts.js
instead of the JSON-file to make it tree shakable. It also makes it possible to be used directly by 3rd-party scripts, like Jest, without the need to run again whole compilation which due to Grunt massiveness can take some time.
[templates] Renamed components and layouts Nunjucks files to not use leading _
in names since due to changes in related Grunt task configuration it is enough to use leading _
in directory that houses them to prevent building into standalone pages.
[data] Made SOCIAL.url
optional since in some cases social service might not require one.
[data][templates][locales] Provided better default placeholders. Instead of too abstract company
added following properties:
name
— project nameshortName
— project short namedescription
— project description[config] Enabled some new Stylelint rules:
unit-no-unknown
block-opening-brace-newline-after
block-closing-brace-newline-before
string-no-newline
no-empty-source
selector-max-pseudo-class
no-empty-first-line
function-calc-no-invalid
at-rule-property-requirelist
max-nesting-depth
: added ignoring of the pseudo-classes
scss/dollar-variable-colon-newline-after: always-multi-line
scss/at-each-key-value-single-line: true
scss/function-quote-no-quoted-strings-inside: true
scss/function-unquote-no-unquoted-strings-inside: true
scss/selector-no-union-class-name: true
scss/comment-no-loud: true
[configs][package] Make Jest use for @data
mapping precompiled temporary file temp/data/scripts.js
instead of the modules/scripts-data.js
. That makes tests running significantly faster because it avoids precompilation of the data for each test file. To make it work, pretest
NPM script has been added, which ensures that data is always precompiled before running any tests.
grunt-jspm
not counting built files properly.lru-cache
initialization — newer versions should always use new
keyword.Changelog
1.14.0 - 2018-06-07
[package] Updated dependencies.
[package] Updated JSPM to v0.17.0-beta.48.
[styles] $ekzo-font-families
now uses unquote()
to declare fonts. Helps to avoid issues when merging font family with predefined font familis stacks:
$ekzo-font-families: (
- base: '"Open Sans", #{$ekzo-helvetica-font-stack}',
+ base: unquote('"Open Sans", #{$ekzo-helvetica-font-stack}'),
monospace: $ekzo-consolas-font-stack
);
[templates] Structured data for social links in <head>
will no longer be outputted if services actually doesn't have url
property.
This can happen, when site using only image for this service, but doesn't have account in social network.
[ci] Updated configs to work with Node 10.
[ci] Change npm install
to npm ci
, which is faster and does not change package-lock.json
.
[ci] Updated CircleCI config to cache NPM modules and JSPM package separately.
path.join
instead of more appropriate urljoin
.grunt-jspm
will no longer fail on NPM warnings.grunt-jspm
will no longer exit before all files have been built.npm test
no longer invoked automatically. Fixed by forcing npm test
to run before build.Changelog
1.13.0 - 2018-03-30
[grunt] Added grunt-jspm
task which allows launch JSPM watch and build within Grunt.
JSPM no longer needs to be launched with npm-run-parallel
and JSPM running process is now synchronous and predictable.
Besides, new JSPM task able to handle simultaneous watch of multiple packages.
Note, that task uses child_process.spawn
under the hood. Because JSPM does not expose its watch API, for now it is possible to be launched only with CLI.
[grunt] Added grunt-jspm-emitter
which is responsible for launching chockidar-socket-emitter
, which is watching scripts changes and emits them to SystemJS when Kotsu started in Hot Reloading Module mode, with --hmr
flag #230
[package][modules] Added version
NPM script and called by it modules/changelog-version
.
This is a small experimental unility, which will run everytime version will be bumped with npm version
command, so that you'll never forget to update CHANGELOG version before release. Of course, if CHANGELOG exists at all.
Note, that to work CHANGELOG should follow keepchangelog.com specs.
[modules] Added SITE.matter.$raw
internal property, which holds not rendered Front Matter.
[modules] Added cache
module which provides a central cache storage and additional method for memoizing function results based on it's arguments or specified cache store key.
Cache itself based on lru-cache.
Examples:
const { cache, cacheFunc } = require('./modules/cache')
cacheFunc(renderFunc)('{{ value }}', { value: 'test' })
// -> 'test'
cacheFunc(renderFunc, 'matter')('{{ value }}', { value: 'test2' })
// -> 'test2'
cache.get('123er23')
// -> 'test'
cache.get('matter')
// -> 'test2'
[grunt] Replaced shell:jspm_watch
and shell:jspm_build
tasks with jspm:watch
and jspm:build
.
Besides, jspm:watch
is now also part of the serve
task.
[modules] Matter data is no longer rendered ad hoc (by calling getPage()
, etc), and instead rendered only once during environment configuration.
Raw version of same matter is always available under SITE.matter.$raw
.
Beware that due to those changes, in default rendered and cached version page-specific context variables, like PAGE.locale
won't be available. Pieces with such variables should be rendered explicitly with render()
filter applied to $raw
version of data.
[modules][nunjucks] Nunjucks getPage()
no longer renders Matter data and instead returns rendered and cached data.
For rare cases, when some additional rendering with specific context required, raw pages data available under $raw
property.
{% set item = getPage('/item').props.title %}
{# -> 'Якась сторінка' #}
{% set item = getPage('/item').$raw.props.tile %}
{# -> '={{ gettext("Some page") }}' #}
[modules] Simplified code related to caching of data.SITE.matter
and data.SITE.images
.
[modules] It is now possible to import clear-workid
module without causing side effects and run it later. Just in case someone want to, let's say, test it... Like we shouldn't test it too...
Running it with node
will work the same way as before.
[modules] Improved clear-workid
output visuals.
[grunt] Removed grunt-shell
which was used to launch JSPM watch and build. It has been replaced by grunt-jspm
which spawns JSPM process #230
[package] Removed js:watch
script, since it is handled by grunt-jspm
by now #230
[package] Removed npm run start-hmr
, npm run serve-hmr
and related subtasks.
Just use npm start -- --hmr
or npm run serve -- --hmr
to launch Hot Module Reloading.
[package] Removed npm-run-all
package, since due to newly added grunt-jspm
and grunt-jspm-emitter
it no longer used #230
[templates] Removed Nunjucks getPage()
function forceRender
and cached
options, because getPage()
now always returns rendered and cached pages data, while raw version available with $raw
property.
grunt-nunjucks-2-html
to version 2.2.0 vitkarpov/grunt-nunjucks-2-html#56require
and module.exports
.Changelog
1.12.0
[styles] Added inputs default styling to textarea
and select
.
[scripts] Added built-in crucial polyfills for DOM matches
, closest
and classList
methods.
[scripts] Initial console.log
will now display current Circle CI build number and commit SHA1, which caused it.
[misc] Added more cleaning directives in robots.txt
.
[modules] Added more aggressive caching for SITE.matter
, which makes single require of matter files instead of require per each rendered file.
[modules] Added module sass-extensions
which now is a home for all Sass functions and other extensions.
[modules][styles] Added Sass function kotsu-data
with access to all Kotsu data. It is a replacement for kotsu-path
and kotsu-theme-colors
functions #35
[templates][modules] Added Nunjucks imageSize()
function which takes in image paths and returns image-related data:
{% set image = imageSize('path/image.jpg') %}
{{ image.src }} returns 'path/image.jpg'
{{ image.width }} returns 100
{{ image.height }} returns 200
{{ image.set() }} returns all images in set
{{ image.srcset() }} returns `srcset`
See additional cases in test file.
[grunt] Added grunt-image-size
task, which collects data about each image.
[grunt] Added grunt-write-json
task, which compiles JS to JSON-file. Used as to prepare data for frontend scripts.
[data] Added ability to pass data from Grunt and source/data
to frontend scripts, which are handled by JSPM.
This is done by editing source/data/scripts.js
file, which later will be compiled into JSON file with grunt-write-json
Grunt task.
Data available to scripts from @data
module:
import data from '@data'
console.log(data)
Yeap, less than ideal, but hopefuly it will be improved in future.
[data] Added ENV.buildNumber
build number and ENV.buildSHA1
with commit SHA1 which caused build.
[data] Added new data property SITE.images
, which holds images information collected by grunt-image-size
.
[data] Added new data property PATH.file
which points to Gruntfile file.build
values.
[conf] Enabled new SCSS Stylelint rule:
scss/dollar-variable-colon-space-after: at-least-one-space
[package] Update package-lock.json
for greenkeeper builds and upload it to github using greenkeeper-lockfile
package, closes #350
[package] Added jest.config.js
where now stored Jest config from package.json
.
[package] Added preversion
script, which will run tests and build before npm version
command.
[package] Updated dependencies.
[package][data] twitter
proprty is no longer a part of the package.json
. It's moved into data SOCIAL.twitter.handle
instead.
[package] Removed grunt-contrib-uglify
in favor of uglify-js
bundled with jspm
#294
[package] Moved Jest config from package.json
to jest.config.js
.
[grunt] Split tinypng:build
task into tinypng:sprites
and tinypng:images
tasks, which are stored now in sprites
and images
tasks files.
tinypng:images
is disabled by default to avoid awkward situations...
[styles] Default .Icon--left
and .Icon--right
classes now have more reasonable margins.
[styles] Replaced all kotsu-path
and kotsu-theme-colors
functions instances with kotsu-data
function. Queries inside functions have been changed too, to access needed properties:
- $ekzo-images-path: '/' + kotsu-path(images);
+ $ekzo-images-path: '/' + kotsu-data('PATH.images');
- $ekzo-ui-path: '/' + kotsu-path(images) + '/ui';
+ $ekzo-ui-path: '/' + kotsu-data('PATH.images') + '/ui';
- $ekzo-sprites-path: '/' + kotsu-data('PATH.sprites');
+ $ekzo-sprites-path: '/' + kotsu-path(sprites);
- $ekzo-fonts-path: '/' + kotsu-data('PATH.fonts');
+ $ekzo-fonts-path: '/' + kotsu-path(fonts);
- secondary: kotsu-theme-color(),
+ secondary: kotsu-data('SITE.themeColor'),
[scripts] ES6 in, CoffeeScript out.
CoffeeScript is no longer a part of the Kotsu. All code rewritten in pure ES6, all .coffee
files renamed to .js
, all imports no longer referring to .coffee
extension, CoffeeScript no longer supported by Jest testing environment out of the box.
Process of transition has been accompanied by VHS Glitch - Blood In Blood Out.
[scripts] main.js
content no longer wrapped into jQuery function.
Since the script is placed in the end of the HTML, when the DOM is loaded, and JSPM anyway wraps content of each module into a function and leaking into a global scope variables no longer possessing any threat, there is simply no sense to continue doing this in 2018.
[modules] node-gettext
has been updated to the version 2.0.0
and related gettext
module completely rewritten. It is no longer a class, but a simple function, which returns same Gettext methods as before.
[modules] gettext
will now log to the console errors in case any translation is missing.
Closes #46.
[modules][grunt][data] Matter data is no longer defined in Nunjucks task and instead passed explicitly as a part of SITE.matter
data within data index
file.
[modules][grunt] styles
task file has been cleened up by moving Sass functions into standalone module modules/sass-extensions
.
[modules][tests] All testing utilities moved directly into modules
.
[modules] modules/nunjucks.js
renamed to modules/nunjucks-test-utils.js
.
[templates] Changed paths in _base.nj
script block:
PATH.scripts
main.js
replaced with PATH.file.script.compiled
PATH.scripts
main.min.js
replaced with PATH.file.script.minified
[templates] Due to update of numbro
to version 2.0.0
numbro.setCulture()
method has been changed to numbro.setLanguage()
.
[styles] Updated Ekzo to HEAD version past 2.6.0.
[styles] Loading order of settings files within settings layer no longer matters.
[data] Reworked the way paths supplied to index data file PATH
from Gruntfile.
Now, out of the box, index file will automatically pickup following settings from Gruntfile:
path.build
will be stripped of the build root and placed in the root of PATH
file.build
will be stripped of the build root and placed in PATH.file
path
will be placed as it is in the root of PATH
, which makes all path
values accessible in data consumers by following PATH.source
, PATH.build
, etc.No changes to structure was made except newly added PATH.file
property. However, with this change it is no longer required to manually map Gruntfile path
and file
values to data file PATH
. Instead, Kotsu will pick up all of them them for you.
[data] Matter data property renamed from SITE._matter
to SITE.matter
.
[data] Data file now destructuring config()
values once to avoid numerous config()
calls. This should improve performance in large data files.
[data] Data file now using path.join()
method to properly concatenate various paths.
[tests] runGrunt
test utility now returns console output in case of resolve.
[ci] Update Travis and CircleCI configuration files to use nove v9 for tests and builds.
[grunt] Removed file.build.style.tidy
setting. Now it's embedded into uncss
task directly.
Since this paths shouldn't be used anywhere else, keeping it in main Gruntfile didn't make much sense.
[grunt] Removed file.build.sprite.hash
setting. Now it's embedded into tinypng
task directly.
[grunt] Removed grunt-responsive-images-extender
in favor of newly added imageSize()
Nunjucks function.
[package][scripts] jQuery
no longer shipped with Kotsu by default. The time has passed. Use native DOM API.
[package] Removed Jest config property from package.json
in favor of jest.config.js
.
[package] Removed tests/utils/jest.js
in favor of jest.config.js
.
[temlates] Removed imports
block from _base.nj
layout. They weren't useful since you wouldn't be able to extend base layout without them anyway.
[modules][styles] Removed kotsu-path
and kotsu-theme-colors
functions in favor of more generic function kotsu-data
which has access to all Kotsu data #35
[styles][templates] Removed pages-related classes like p-index
and p-blog
.
Such usage is deprecated. Pages are complex components and should be threaded just like any other component. Thus, components classes like Index
for the index page or Blog
for the blog encouraged instead.
urljoin()
.Changelog
1.11.0
text-decoration-skip: ink;
to default links style.Date
refinament which expects ISO 8601 date.[package] Updated dependencies.
[package] Updated Ekzo to version 2.6.0.
[grunt] SEO-related comments <!--noindex-->
and <!--/noindex-->
will no longer be stripped during HTML minification.
[grunt] Comments starting with !
like <!--! do not ignore-->
will no longer be stripped during HTML minification.
[templates] Moved global components imports from _base.nj
layout into components and layouts where they are actually used. Global imports no longer encouraged.
In such way components will declaratively show their dependencies on each other. It will solve two issues:
Importing many times same components even in 300-pages projects does not have any performance-wise implications. So, why not?
Note, that for components you need to place imports in the beginning of the file, outside of {% macro %}
:
{% from '_components/_NavItem.nj' import NavItem with context %}
{% macro Nav() %}
<p>Macro content...</p>
{% endmacro %}
However, in case of layouts which extends to import components with context, import should be placed inside {% block %}
, otherwise context will end up undefined:
{% block main %}
{% from '_components/_Example.nj' import Example with context %}
<p>Content...</p>
{% endblock %}
[templates] Moved id
of the Example()
component, which is generated based on title, from heading to <article>
. This will ensure that example's generated link will properly scroll to element itself in cases when heading is changed in some specific ways...
[templates] Improved components doc blocks. Now they should confront JSDoc standards.
[modules] Improved isActive()
function performance by exiting early during checks and not using RegExp in exact mode.
[modules] Nunjucks isActive()
function is now stricter in non-exact mode. It will match only full segments and not literal parts of URLs.
For example, from now for isActive('/test')
those are different URLs even in non-exact mode:
/test/page
/test234/page
While those are not:
/test/page
/test/234/page
[modules] Fixed isActive()
Nunjucks function returning wrong results for URLs with partial match.
Few examples for page with URL /test/page
:
{{ isActive('/tes') }} {# has been wrong `true` #}
{{ isActive('/tes/') }} {# has been wrong `true` #}
{{ isActive('/test') }}
{{ isActive('/test/') }}
{{ isActive('/test/pag') }} {# has been wrong `true` #}
{{ isActive('/test/pag/') }} {# has been wrong `true` #}
{{ isActive('/test/page') }}
{{ isActive('/test/page/') }}
Changelog
1.10.0
[templates] Added default canonical URL to each page, which references page itself.
Predefined canonical URL will avoid search providers being confused in case of duplicate content caused by dynamic parameters in URL like those:
https://example.com
https://example.com?search=test
Canonical URL will tell search providers to always treat original page without parameters as canonical and the one, which should be displayed in search results.
To disable default canonical URL, specify in Front Matter:
---
canonical: false
---
Or set your own canonical:
---
canonical: /this-is-real-page
---
See #326 for details.
[docs] Added documentation from Wiki into docs
directory.
Behold, :blue_book: The Documentation! Well, not much. But some day a miracle will happen...
[package] Updated dependencies.
[grunt] Enabled additional compression options in grunt-contrib-htmlmin task.
Here is full list of added options:
minifyJS: true
minifyCSS: true
processConditionalComments: true
quoteCharacter: "'"
sortAttributes: true
sortClassName: true
As a result, inlined JS CSS and IE conditional comments will be minified.
Sorting of attributes and class names will allow to gzip pages even better.
[templates] PAGE.canonical
no longer accepts array of URLs. Instead only one URL can be provided.
This should prevent stupid situations, when people specifing multiple canonical URLs without understanding how Google and Yandex will treat it.
See #326.
[templates] Removed not needed indentation from Front Matter sections.
[templates] Prettified Google Analytics and Yandex Metric snippets. They will be uglified anyway.
[templates] Prettified Nav
components Item
. Yeap, now it takes more space, but at least now it is readable.
type="text/javascript"
attribute in <script>
tag of Yandex component.Changelog
1.9.0
[templates] Added ability to exclude certain pages from Breadcrumb()
component with new Front Matter excludeFromBreadcrumb
property set to true
.
It is useful for for landing or tag parent index-pages, which should never be listed in breadcrumb.
Note, that it will also hide page from breadcrumb in search snippets.
[templates] Added lastItemClass
parameter for Breadcrumb()
component, which allows to set specific class on last item of the breadcrumb.
[modules] Added better error output for traverse
and relied on it nunjucks-render
and format
.
New error includes input, which failed rendering. For objects it will include currently rendered string of the leaf.
[modules] Added error messages in case wrong values passed to getLocaleProps()
, getLocaleDir()
and related Nunjucks localeDir()
.
This should clarify obscurity of vague and hard to debug internal errors when grunt.locales
, Matter's SITE.locales
or PAGE.locale
are undefined or wrong.
[conf] Added caching of node_modules
for Travis.
[tests] Added Breadcrumb()
Nunjucks component tests.
[grunt] Generated sitemap.xml
will no longer have trailing slashes in URLs, which makes it uniform with trailing slash-less URLs in site navigation.
To revert this change, remove from Grunt config sitemap_xml.options.trailingSlash: false
option.
[templates] Breadcrumb()
component now will always print last item, regardless of displayLast
option. However, when displayLast
enabled, last item will be hidden visually and for screen readers with display: none
.
It required to confront requirements for BreadcrumbList
structured data, dictated by Google. Breadcrumb should be full and include all tail.
[templates] Breadcrumb()
last item changed from <span>
, which previously indicated inactive element, to fully working <a>
.
It's done to confront BreadcrumbList
structured data requirements.
If you still wish to keep last item inactive, use newly added lastItemClass
option to set a specific class, like g-link--inherit
, which will make anchor appear like a regular text, making it inactive for users, while still accessible for bots.
[package][tests] Replaced NPM postbuild
script, which checks clean working dir, with more reliable clean-workdir.js
test.
It will no longer occasionally pass wrongly test when grep
is unavailable (like in Windows environment out of box).
[conf] Both Travis and Circle CI will no use latest version of NPM to avoid issues with discrepancies regarding package-lock.json
format.
It is recommended to use for development latest NPM too:
npm install -g npm@latest
[conf] Enabled again package-lock.json
updates on npm install
for AppVeyor #289.
[grunt] Thanks to update of grunt-gray-matter
to version 1.3.0 pages with Front Matter having syntax errors will no longer be silently ignored.
Instead, detailed error message will be thrown.
See #320.
[conf] Fixed Travis ignoring failed tests and exit code 1 in postbuild phase.
It is happened because when script runs in after_success
phase exit codes 1 are ignored. See Travis docs.
Thus, .travis.yml
after_success
changed to script
which will properly react to exit code 1.
[tests][package] Fixed Jest testPathIgnorePatterns
which resulted in ignoring tests on some CI (like Travis).
For instance, Travis builds into /home/travis/build/LotusTM/Kotsu
, and specified /build/
in ignore patterns of Jest effectively ignored any path, which contained build
. See jest#1057.
<rootDir>
has been added to ignore only contained in root build
and temp
directories.
Changelog
1.8.0
[templates] Outdated Browser component now has rel='nofollow'
specified in the link.
[templates] Example component now will generate id and anchor for each heading, so it is possible to reference specific section whenever needed
[modules] Added traverse
function to walk Objects and Arrays and recursively apply specified function with a predicate. Mostly useful for Kotsu internal dark deeds — rendering Objects and Arrays :sparkles:
[modules] Added format()
(sprintf()
) tests.
[modules] Added experimental ability for nunjucks-render
to specify this
of context, which by default points to input itself.
This is useful feature to use in data structures for self-referencing:
{% set data = {
name: 'Mike',
hello: 'hey {{ this.name }}'
}|render() %}
{{ data.hello }} === hey Mike
[conf] Added whitespace trimming disallow to .editorconfig
for Jest snapshot files. To avoid very stupid situations with broken snapshots...
[conf] Added new SCSS Stylelint rules:
scss/at-else-if-parentheses-space-before: always
scss/at-function-parentheses-space-before: never
scss/at-mixin-parentheses-space-before: never
Functions and mixins declarations now require space before (arguments)
, to follow codestyle enforced by standard
in JavaScript.
[utils] Added information about type for tcomb
Maxlength
refinement.
[package] Updated dependencies.
[grunt] uncss
task will now ignore any remote CSS by default (starting with https
, http
or //
) to avoid pulling into main stylesheets file unexpected external CSS, which can be downloaded by 3rd-party scripts.
Instead, it is recommended to whitelist needed remote files explicitly, to be sure about what gets into main stylesheets and to avoid unexpected duplication.
[modules] Improved nunjucks-render
.
Now it renders objects and arrays recursively and no longer relies on JSON.stringify()
.
As a result, slightly improved performance, less limitations, implied by JSON stringification, and no more tricky code to properly remove escaping of Nunjucks templates.
See #173.
[modules] Improved sprintf
, which used as format()
filter in Nunjucks.
Now it applies sprintf
recursively to input and no longer relies on JSON.stringify()
with all its limitations.
As a side effect, it gains minor performance boost and will no longer trigger stupid errors with any string containing normal percentages, like 23%
.
See #173.
[modules] Converted sprintf
to pure JavaScript #287.
[modules] Converted nunjucks-render
to pure JavaScript #287.
[modules] Renamed sprintf
to format
, just for consistency with filter used in Nunjucks.
[modules][utils] Move tcomb
refinements
and validate
from test utils to modules, since they can be used not only for testing.
[package] Renamed main JSPM package from kotsu
to more generic main
. which better reflects main file name.
[grunt][templates] During JSPM build and SystemJS.import()
now used main package name (main
).
Finally full filepath no longer required during JSPM build invocation :guitar:
[styles] In supplied theme-file outer-space
color renamed to more generic secondary
color.
[styles] Update codestyle — functions and mixins declarations now require space before (arguments)
.
[styles] Update Ekzo to version 2.5.3.
[styles] Given better comments headers for Btn component file.
[static][templates] Renamed mstile.png
and mstile-wide.png
icons to mstile-310x310.png
and mstile-310x150.png
to be more specific sizes and usage.
[ci] Disabled package-lock.json updates on npm install for AppVeyor #289.
[utils] More robust way to get type name for tcomb
EqualKeyAndProp
refinement.
[utils] Split tcomb
util file into refinements
and validate
files with standalone tests.
[tests] Improved Nunjucks render()
filter tests.
mstile-70x70.png
icon.tcomb-validation
version being not locked..DEFAULTS
in the end. That was a shadow of far past...//
protocol instead of https
. Are you still using HTTP
? Don't be afraid. That won't hurt you. But I burp'n will.Changelog
1.7.0
[package] Added package-lock.json
for Node 8+.
[package] Added browserslist
to package.json
with preseted browsers queries. See article for details.
[package] Added tcomb
and tcomb-validation
for runtime type annotation and data validation. See #165 for details.
[package] Added URI.js
.
[package][grunt] Added ability to pass command line argument from npm start
and npm run build
to grunt
. For instance, this can be useful to build website in production mode with npm start -- --production
[package][grunt][templates][data] Added ability to run Kotsu optionally with regular watch or hot reloading, on demand.
As turned out, hot reloading doesn't work that well for non-SPA applications. But we thought, why would we force devs to chooses only certain approach?
So, now devs can choose between launching fast JSPM watch with npm start
, or use hot module reloading with npm run start-hmr
.
That easy!
[grunt] Added grunt-responsive-images-extender
task which automatically expands images src
with srcset
when there are same images available with different images sizes and prefixed with @
. This will significantly reduce images-related payload on small devices. Note, that task doesn't watch for images changes. It will run only once during npm start
and as part of npm run build
, since it's more production-related optimization.
[grunt] Added cache busting for images (.jpg
, .jpeg
, .gif
, .png
, .svg
) with query string. This won't affect the final name of an image but will prevent that awkward situation, when your boss asks you why he still sees old image on production...
[grunt] Added tiny debouncing delay for Browser Sync. It will prevent a huge amount of reloads when a lot of files changing in a row (for instance, after all, Nunjucks templates recompilation).
[grunt] grayMatter
task now uses urljoin()
for URLs resolution to make path concatenation more reliable and no longer relies on Node URL resolver.
[templates] Added AlternateUrls()
Nunjucks component which encapsulates logic around generating alternate URLs meta tags in _base.nj
.
Well, not like you'd need to use that component anywhere on your own, but had to put a note about it somewhere... you know...
[templates] Added ability to specify body class for specific pages with bodyClass
Matter data, pageDefault.bodyClass
in default data or {{ config('page.bodyClass', ...) }}
within Nunjucks template.
[templates] Added ability to specify page-specific viewport with viewport
Matter data.
[templates] Added to _base.nj
layout blocks {% block imports %}
, {% block fonts %}
, {% block css %}
and {% block js %}
which encapsulates macros imports, fonts-related stylesheets, site stylesheets and <script>
tags respectively.
It allows to extend base layout and whenever needed to override font, CSS or JavaScript content on demand by calling block with desired content:
{% block css %}
<link rel='stylesheet' href='/myStyles.css'>
{% endblock %}
Or use {{ super() }}
inside any block to invoke original _base.nj
blocks content whenever page should use same stylesheets or scripts, but you need to add few additional files:
{% block css %}
{{ super() }}
<link rel='stylesheet' href='/myOtherStyles.css'>
{% endblock %}
Since _base.nj
contains only basic HTML wrapper and encapsulates mostly meta data-related features, those changes make it a good basement for all website pages, even unique ones, thus eliminating need to replicate _base.nj
functionality for those pages.
[templates] Added Open Graph locale:alternate
meta tags based on SITE.locales
data.
[templates][data] Added ability to specify Open Graph and Twitter meta data for specific pages by porviding one of the following properties as Matter Data or PAGE_DEFAULTS
in general data:
---
og:
type:
site_name:
url:
title:
description:
image:
locale:
locale:alternate:
twitter:
card:
site:
creator:
url:
title:
description:
image:
image:alt:
If not provided, meta properties will fallback to page or site generic values, as before.
[templates][data] Added ability to specify canonical urls for specific pages with Matter Data, using following structure:
canonical:
- test/page
- https://othersite.com
[templates][data] Added ability to specify alternate urls for specific pages with Matter Data, using following structure:
alternate:
- locale: mylocale
url: test/page
- locale: extlocale
url: https://othersite.com
[templates][data] Added PAGE.image
Matter Data property, which allows specifying generic meta image for the page. It can be used by other pages (for instance, to generate a table of content with previews or for structured data markup) and also will specify an image for Open Graph and Twitter meta data, unless they have already specified images. Related to #219.
[data][templates] Added SITE.logo
data property for main site logo, which defaults to logo.svg
and used in _main.nj
layout.
[templates] Added vocab='https://schema.org/'
to top-level <html>
of _base.nj
. This means that you can use freely Schema vocabulary without specifying or prefixing it as typeof='ListItem'
instead of vocab='https://schema.org/' typeof='ListItem'
or typeof='schema:ListItem'
whenever you extend base layout.
[templates] Added ability to reference website's Organization structured data by stating resource='#this'
.
[templates] Added ability to reference website structured data by stating resource='#this-website'
.
[templates] Added structured data for blog posts according to Google guidlines.
[templates] Added structured data for the website and preferred site name according to Google guidlines.
[templates] Added structured data for Breadcrumb
component according to Google guidlines.
[templates] Added structured data for logo according to Google guidlines.
[templates] Added structured data for social profiles according to Google guidlines.
[templates] Whenever URL concatenation involved now used urljoin()
instead of plain concatenation.
[templates] Added manifest.json
as Nunjucks template manifest.json.nj
, which uses Kotsu data #270
[modules][templates] Added URI.js
as URI()
Nunjucks function.
[modules][templates] Added absoluteurl()
Nunjucks function, which will resolve relative or absolute URLs to full URL, with site homepage, based on current page URL, while already full URLs, with protocols, will remain unaffected.
[static][templates] Added more favicons variations to work better with modern browsers.
[tests] Added tests for Nunjucks render()
filter.
[tests] Added validate()
test utility which wraps tcomb-validate
and print nice errors on fail.
[tests] Added some handy tcomb
refinements to make life easier and your data truthy:
False
— to accept only false
Absoluteurl
— to accept only absolute URLs, like https://wowsomuch.test
Imagepath
— to accept only paths with images, like testme.png
Handle
— to accept only handle, like @lotustm
. Useful for Twitter-related data, you know.Maxlength
— to accept only strings, numbers or array (or anything with .length
property) which doesn't exceed a specified length.EqualKeyAndProp
— to accept only objects, in which some properties are equal to key value. For instance, when you need to ensure that object key and id
property are always equal.[tests][data] Added index.test.coffee
the file which tests data index file with tcomb
to ensure that Kotsu receives all required data with valid values. Wrong data, you shall not pass!
Also, it serves as an example for writing project-specific data validation files.
[tests] Added isActive()
Nunjucks function tests.
[images][templates] Hardly believable, but we have finally added Kotsu logo as logo.svg
file and placed it in _main.nj
layout. Now it serves as a placeholder for your beloved logo file.
[package] Updated dependencies.
[package] npm start
will now run regular JSPM watch instead of hot reloading. For hot reloading use npm run start-hmr
command.
[package] Changed npm-run-all --parallel
to shortcut run-p
.
[package] Moved check of clean workint tree with Git after grunt build
into standalone postbuild
script, which will automatically execute after npm run build
.
This will also allow to pass any options to grunt with npm run build -- --myOption
.
[misc] With update of Stylelint to 7.12.0 updated .stylelintrc.yml
config accordingly. Note, that you might need to change selector-no-id
, selector-no-universal
and selector-no-type
to selector-max-id
, selector-max-universal
and selector-max-type
respectively, and don't forget about stylelint-disable
directives.
[conf] Replaced Stylelint rule at-rule-no-unknown
with newly added stylelint-scss
rule scss/at-rule-no-unknown
.
[conf] Enabled selector-max-attribute
Stylelint rule and set to 0
, so you might need to check your selectors.
[conf] Enabled Stylelint at-rule-empty-line-before
rule.
[conf] Enabled Stylelint declaration-empty-line-before
rule.
[conf] declaration-colon-newline-after
Stylelint rule set to always-multi-line
, which forces to write list values on multiple lines for better readability.
[ci] switched CI to latest node LTS release (v8.0.0).
[templates] Moved Host
and Sitemap
directives in robots.txt
under the User-agent
directive, in accordance with guidelines.
[templates] Replaced all occurrences of metaDesc
Matter Data property with description
. This will make it more unified with package.json
, Open Graph and Twitter naming.
[templates] Replaced all occurrences of shortDesc
Matter Data property with more common excerpt
.
[data] All data properties are in upper case now. It effectively denotes global data from local, defined within specific template, and with their new constants-like appearance showing that it is better to be accurate when reconfiguring those properties internals or better not to touch them at all.
As result of that change, all templates and other parts of Kotsu should now access following global properties:
PAGE
instead of page
PATH
instead of path
SITE
instead of site
PAGE_DEFAULTS
instead of pageDefaults
ENV
instead of env
See #258 for details.
[data][templates] Declared in Nunjucks _base.nj
layout SITE.placeholders
are now part of source/data/index
and declared within new global property PLACEHOLDERS
, which contains all global placeholders for format()
Nunjucks function.
This means, that all format(SITE.placeholders)
instanced should be changed to format(PLACEHOLDERS)
.
[data][grunt] data.PAGE_DEFAULTS
previously didn't became part of Matter Data and was injected only on _base.nj
invocation. That made accessing this data in other instances problematic. Now, data.PAGE_DEFAULTS
will be injected during grayMatter
task instead.
[date][templates] Replaced SITE.desc
with more common description
to be more consistent with package.json
.
[data][templates] Old social-related properties in SITE
replaced with more verbose SOCIAL
property, which encapsulates data about site's social presence following this scheme:
SOCIAL:
# Add any other social services following same pattern
twitter:
handle: pkg.twitter
image: imagesPath + '/twitter.png'
url: "https://twitter.com/#{pkg.twitter}"
facebook:
image: imagesPath + '/facebook.png'
url: 'https://www.facebook.com/Lotus-TM-647393298791066/'
This data can be later used to generate site social icons or for structured data.
[data][templates] Default value for Open Graph and Twitter image meta data no longer hard coded to facebook.png
and twitter.png
, but instead part of data and exposed as SOCIAL.faceebook.image
and SOCIAL.twitter.image
properties.
[templates] Open Graph and Twitter images properties now uses new absoluteurl()
Nunjucks function to resolve the path to images. This means, that you can freely enter as a path to image remote URL, or local absolute, or local relative URL, and it will be properly resolved.
[templates] Replaced redundant ternary operators in base layout and some components with simple or
operator. Example: {{ PAGE.title if PAGE.title else SITE.name }}
-> {{ PAGE.title or SITE.name }}
.
[templates] In Nav()
component {% call(depth) Item('/') %}{% endcall %}
changed to exact mode to not match inner routes due to introduced in isActive()
fix.
[templates] Link()
component refactored and will no longer throw any warnings itself in case of document-relative URLs since it is handled by relied upon isActive()
. It also will trim whitespace to reduce issues with inlined links.
[modules] i18n-tools
nunjucksExtensions
method now pulls locales information from context SITE.locales
and no longer requires locales
, baseLocale
and currentLocale
parameters to be invoked.
Yeap, it makes a bit obscure what exactly i18n-tools
data require to work, but on other side provides much better flexibility, since now it will respond to context locales values changes.
[modules] nunjucks-extensions
module now too pulls locales information from context SITE.locales
and no longer requires currentLocale
, numberFormat
, currencyFormat
parameters to be invoked.
[modules][templates] nunjucks-render
and related Nunjucks render()
filter now will correctly process input in form of String or Number Objects, which aren't primitives, including Nunjucks SafeString, without need to set isCaller
parameter to true
. Such situations could occur if render()
filter was used directly on Nunjucks macro or its caller()
.
[modules][templates] Refactored isActive()
Nunjucks function to be slightly faster and less obscure.
[modules][templates] getLocaleDir()
and related Nunjucks counterpart localeDir()
now returns /
for base locale instead of hacky empty string.
The old behavior was needed to ease concatenation with URLs, but since all that logic now handled by urljoin()
, we can safely return /
for a base locale to properly denote that it lives at the root.
[modules][templates] getLocaleDir()
and related Nunjucks counterpart localeDir()
now returns locale path with always trailing /
, unless url specified.
[modules] getLocaleDir()
no longer requires whole locale properties as input and instead has locales
as first argument, which should be proper Kotsu locales object.
[modules][templates] getLocaleDir()
and related Nunjucks counterpart localeDir()
now more tolerable to locales, which do not exist in locales
object.
It will now try to find URL of locale, otherwise, will return locale name as a path.
[modules][templates] Certainly obscure header of _base.nj
layout related to PAGE
data retrieving has been encapsulated into initPage()
Nunjucks function, which makes relatively the same thing, but now have documentation, which sheds some light on how things works.
As of this change, following _base.nj
header:
{{ config('PAGE', { breadcrumb : PAGE.props.breadcrumb }) }}
{{ config('PAGE', getPage(PAGE.breadcrumb).props|format(PLACEHOLDERS)) }}
{{ config('PAGE', PAGE.props) }}
has to be changed to
{{ initPage() }}
It will also make much easier loading of Matter data in your own custom layouts by invoking that function in the beginning of the layout and then observing how happiness and joy fill your life.
[modules][templates] isActive()
Nunjucks function now will throw TypeError
in case of relative url.
[modules][templates] currentLocale
is no longer mandatory property for Nunjucks task, it will fallback to baseLocale
if no locale specified.
[modules][templates] Nunjucks urljoin
function now uses instead of url-join
more reliable URI.js
.
Note, that it is slightly modified:
urljoin
arguments are slashes or empty strings, it will resolve to /
if the first argument is /
. See related issue medialize/URI.js/#341 and related tests.[modules] Changed sections comment-headers always be 80 chars long.
[data] Reordered SITE
properties to make it more consistent with the order of package.json
.
[styles] Updated Ekzo to version 2.5.2.
[styles][grunt] Updated Sass files to use same comments headers as Ekzo 2.4.3 — 80 chars long.
[styles] Update stylelint-disable
to use changed Stylelint 7.12.0 rules.
[styles][data] Changed data.themeColor
to be background of website, and kotsu-theme-color()
now uses that value. This will fit better for most websites.
[styles] Due to changes in data.themeColor
, it used now for $ekzo-colors.outer-space
color instead of $ekzo-colors.primary
, which no longer uses that value and should be declared manually. This is something site-specific and should be adjusted on demand.
[grunt] Enabled Nunjucks cache. This will significantly reduce the re-rendering time for large projects.
[grunt] Temporarily disabled watch for images with responsive_images
task, since it doesn't work with grunt-newer
. Resizing all images on each change will be too painful in large repositories. See #251.
[grunt] Due to the removal of baseLocaleAsRoot
setting from Nunjucks task, to achieve same functionality url: '/'
should be used for the locale, which will be served at root:
'en-US':
locale: 'en-US'
- url: 'en'
+ url: '/'
rtl: false
defaultForLanguage: true
numberFormat: '0,0.[00]'
currencyFormat: '$0,0.00'
[grunt] Due to changes in locale path resolving method, it is recommended to use root-relative urls in url
property of locale:
'en-US':
locale: 'uk-UA'
- url: 'uk'
+ url: '/uk'
rtl: false
defaultForLanguage: true
numberFormat: '0,0.[00]'
currencyFormat: '$0,0.00'
Otherwise, the locale will resolve relatively to current page URL.
[static][templates] Replaced old boilerplate favicons with new Kotsu ones.
[static][templates] Converted browserconfig.xml
to be Nunjucks template browserconfig.xml.nj
, to allow it use Kotsu data.
[tests] Overgrown nunjucks-extensions.test.js
testing file for Nunjucks extensions finally has been split into smaller files, each with its own mock context. Generic wrapping canvas around tests in those files has been refactored. Hundreds of kittens saved #252
[grunt] Data changes will now trigger grayMatter
task, since now it relies on part of data (PAGE_DEFAULTS
).
[tests] Nunjucks-related testing utility functions has been moved into standalone file /tests/utils/nunjucks.js
which exports renderString
method. It also now accepts a context as the second argument.
[tests] Nunjucks testing utility function renderString
no longer tries to parse rendered content with JSON.parse
, unless third argument parse
has been set to true.\
[tests] .git
, build
and temp
directories are now excluded from tests to make the launching of tests watch faster in large projects.
[grunt] PostCSS Autoprefixer's browser queries removed in favor of new browserslist
property in package.json.
, so that queries could be used by other related tools. See article for details.
[grunt] Removed grunt-cache-bust
option algorithm: md5
, since it's default value anyway.
[grunt] Removed @config('baseLocale')
calls from data-retriving functions in styles
and data
tasks, since @config('data')()
with no argument will return base locale values anyway.
[data] Removed not needed Grunt templating from index data file for paths and env variables.
[data][templates] removed DATA.currentYear
. As a computed value, it does not belong to data well and it is better to use moment().year()
instead.
[modules][grunt] Removed baseLocaleAsRoot
argument from all i18n-related modules and its related settings in Nunjucks Grunt task.
Use url: '/'
in locale prop to achieve the same functionality.
[modules] Nunjucks 1i8n-related extensions no longer require deprecated baseLocaleAsRoot
value to invoke.
[modules][templates] Removed isCaller
from nunjuck-render
method, since is is no longer needed to make adjustments to input based on whether it is macro's caller or no. This also means that Nunjucks render()
filter no longer accepts this parameter too.
[misc] Removed Stylelint rule at-rule-no-unknown
in favor of scss/at-rule-no-unknown
.
[styles] Removed not needed $prefix: $ekzo-sprites-prefix
from ekzo-sprites()
include.
[styles] Removed no longer needed ekzo-buttons-sizes()
include inside Btn
component, since from Ekzo 2.5.0 it is included by ekzo-for-each-breakpoint
with $include-self
option set to true
.
uncss
not finding scripts because of running after scripts-related tasks.env
properties will not ocassionaly return empty string instead of boolean or undefined
.Breadcrumb()
being unordered list instead of ordered one <ol>
. It's better suits its semantics, since it represents strickly ordered structure.article
. Solves #59.rootTitle
in Breadcrumb
component formatted with sprintf
twice.isActive()
Nunjucks function and related Link()
component wrongly returning false
for isActive('/')
, while it always should be true
, unless set to exact
mode.warn()
Nunjucks function taking url from wrong property.getLocaleDir()
and its Nunjucks countrepart localeDir()
urlifying for no reason locale url. It should be urlified only if no url specified and locale used instead.ekzo-theme()
mixin call in generic/code
file.