NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1711 most downloaded on npm
a few common utility template tags for ES2015
Last release 5 years ago
no release in 18 months
Ships unpredictably
gaps range from 1 weeks to 2.8 years
Nearly every release is documented
notes for 21 of 23 stable releases
1 version withdrawn
withdrawn after publishing
11 years old
26 releases · first in 2015
Tags are now composable; previously this feat was impossible, as tags are functions and would've just been called. After the breaking change you can s…
This is a pre-release. Please help the development of common-tags by testing the common-tags@next version.
Version 2.0.0 is coming. Before it is released however, there are some things to be done - eg. the documentation needs to be rewritten properly for clarity. Maybe the package will be also rewritten into TypeScript? Who knows.
TemplateTag no longer detects whether the argument is a function and subsequently calls it. This may have been a bit convenient, but at the cost of code clarity, and it was also adding extra complication to the core function that should be as lean as possible: (https://github.com/declandewet/common-tags/commit/0c1c971e59a41fb65a41971537fdbe0cf05ab7a6)createTag is introduced as a replacement for TemplateTag. The days of adding new each time you want to combine some tags are over (https://github.com/declandewet/common-tags/commit/74d10765ea1693a256c1eeadeca355c4f90734e2)onString, onSubstitution, onEndResult) now gets and additional argument: context. You can initialize its value in the new getInitialContext hook. This replaces the previously suggested practice of doing something like assigning to this in a hook. For more insight I recommend reading the tests in the linked commit (https://github.com/declandewet/common-tags/commit/c17c2f02e016c0da79755fbf2279980ad9c8b5a2)id. It just returns whatever it receives. Again, for more examples for now look into tests in the following commit (https://github.com/declandewet/common-tags/commit/52120bb72007d3afd7c16bdec2c6b166c561e71b)createTag without a problem (https://github.com/declandewet/common-tags/commit/e3931951c211c475ea54b204a0b54c9c81554b6f)stripIndent and stripIndents (https://github.com/declandewet/common-tags/pull/165)html (aka source aka codeBlock`) should not cause nasty surprises anymore (https://github.com/declandewet/common-tags/pull/182)createTag, TemplateTag is now soft-deprecated. That means you can still use it, but it will print a helpful message that will guide you to the new API (https://github.com/declandewet/common-tags/commit/3ad194684f8e3358a6c042a066da9db745518ac0)One column per quarter.
This release is based on the same code that v1.8.1, but it fixes a regression caused by forgetting to run the build before publishing. Thanks @alumni
This release is based on the same code that v1.8.1, but it fixes a regression caused by forgetting to run the build before publishing. Thanks @alumni for the hint!
The creator of the package changed the handle from declandewet to zspecza, and for a while GitHub was redirecting from the old repo to the new one. Th
The creator of the package changed the handle from declandewet to zspecza, and for a while GitHub was redirecting from the old repo to the new one. This changed with the "takeover" of the original user handle by a random person, and so in this release all the links in package.json are updated to include the new handle.
Previously valueOf was called on objects in templates before toString - now the order is in line with the spec
valueOf was called on objects in templates before toString - now the order is in line with the spec (#144)babel-plugin-transform-runtime was removed as a dependency and as a result babel-runtime is not necessary to use common-tags any more (that means common-tags is dependency-free!) (#148)common-tags is now rolling up into a neat bundle that you can get at unpkg. This makes it even easier to get started with this library! (#150)This was a test release to check if common-tags will register properly with unpkg.com.
This was a test release to check if common-tags will register properly with unpkg.com.
No major changes in this release, we just migrated from the AVA test runner to Jest, which has mitigated some issues with our CI pipeline speeds and r
No major changes in this release, we just migrated from the AVA test runner to Jest, which has mitigated some issues with our CI pipeline speeds and removed some hard to maintain configs.
We've migrated from StandardJS formatting to Prettier's automatic code formatting as well as the recommended ESLint rules. Big props to @fatfisz on th
We've migrated from StandardJS formatting to Prettier's automatic code formatting as well as the recommended ESLint rules. Big props to @fatfisz on this release 🎊
onString - transformers now accept an onString method which runs on each part of the template literal that is not marked as a substitution (i.e. not i
onString - transformers now accept an onString method which runs on each part of the template literal that is not marked as a substitution (i.e. not inside "${}").
replaceStringTransformer(replaceWhat, replaceWith)
Replaces the result of all strings (what's not in ${ ... }) with a new value. Same as for replaceResultTransformer, replaceWhat can be a string or regular expression and replaceWith is the new value.
using tags on regular string literals is now supported
stripIndents preserves empty lines as before
stripIndents preserves empty lines as before (#129)stripIndents removes empty lines - this is a bug and will be fixed in v1.5.1
stripIndents removes empty lines - this is a bug and will be fixed in v1.5.1 (#128)oneLine preserves whitespace within lines (#90) - thanks @hjdivad!inlineArrayTransformer doesn't add extra newlines when maintaining indentation (#114) - thanks @ibrahima!inlineArrayTransformer when there is only one element in an array (#117) - thanks @LucianBuzzo!oneLineTrim works properly in cases where there's no indentation (#126)trimLeft/trimRight were replaced with regular expressions (#127)"start" and "end" were added as new sides accepted by trimResultTransformer (#127)babel-runtime was bumped to ^6.26.0 from ^6.18.0Fixed some incorrect documentation for commaList- tags indicating output to be serial/oxford comma when it was not
commaList- tags indicating output to be serial/oxford comma when it was notinlineArrayTransformerjsnext:main thanks to @k15aRemoves the requirement on NPM3
Removes the requirement on NPM3
adds safeHtml & replaceSubstitutionTransformer
Props to @morcerf on this release 🎊
fixes a small build error on node v4
Fixes a critical bug that prevented more than one use of any tag that uses trimResultTransformer
trimResultTransformerAdds aliases for html tag: source and codeBlock
html tag: source and codeBlockfixes a bug where missing regenerator-runtime would throw errors during the pre-publish build cycle. (end users need not worry about this if using old
regenerator-runtime would throw errors during the pre-publish build cycle. (end users need not worry about this if using older versions)no longer require default when used in commonjs format
default when used in commonjs formathtml tag now properly converts newline characters in strings to actual newlines with indentation
splitStringTransformerhtml tag now properly converts newline characters in strings to actual newlines with indentation_Breaking Change_: removed generic tags function
common-tags to be built on the foundation of the TemplateTag classtags functiononeLineInlineListsReduced size of installed npm package
npm packagebreaking changes: commaLists<*> and inlineList methods now strip indents
require('common-tags/html'), for example)babel-runtimecommaLists<*> and inlineList methods now strip indentsNothing published for this version
Added oneLineStrip option for when you don't want spaces anywhere in your single-line string. Props to @laurentgoudet for this one!
oneLineStrip option for when you don't want spaces anywhere in your single-line string. Props to @laurentgoudet for this one!Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →