diff --git a/CHANGELOG.md b/CHANGELOG.md index 7712e328..17f1995a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,67 +1,72 @@ -## [3.9.12](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.11...v3.9.12) (2020-07-05) - +# [4.0.0](https://github.com/sveltejs/svelte-preprocess/compare/v4.0.0-alpha.2...v4.0.0) (2020-07-07) ### Bug Fixes -* ๐Ÿ› set bare option to true ([312bbb9](https://github.com/kaisermann/svelte-preprocess/commit/312bbb9bbf2668e1750296dbfc8b83bb39f291e8)) +- ๐Ÿ› try to use sass before node-sass ([89aba0e](https://github.com/sveltejs/svelte-preprocess/commit/89aba0e6f03208787cdb7e212979634089405c15)), closes [#163](https://github.com/sveltejs/svelte-preprocess/issues/163) +* ๐Ÿ› bump minimum node version to 9.11.2 ([0befa7f](https://github.com/sveltejs/svelte-preprocess/commit/0befa7f4ff2aa3ba9f0129c3ed3994dd29fb991b)) +* ๐Ÿ› prevent globalify to wrongly split escaped selectors ([f461320](https://github.com/sveltejs/svelte-preprocess/commit/f461320ec05a534021afbe20de0fe097d1016871)), closes [#191](https://github.com/sveltejs/svelte-preprocess/issues/191) +* ๐Ÿ› rename scss prepend option from `data` to `prependData` ([16b1325](https://github.com/sveltejs/svelte-preprocess/commit/16b13253bdf19073c084cb1590ed527695133836)) +### Code Refactoring -## [3.9.11](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.10...v3.9.11) (2020-07-01) - +- ๐Ÿ’ก remove deprecated autoProcess props ([3dce7e4](https://github.com/sveltejs/svelte-preprocess/commit/3dce7e432fb15fc27914f5e1524b46929d84bd2c)) -### Bug Fixes - -* ๐Ÿ› log a warning if local external file is not found ([774aece](https://github.com/kaisermann/svelte-preprocess/commit/774aece08a5279a51707d3f428836169fc7735de)), closes [#174](https://github.com/kaisermann/svelte-preprocess/issues/174) +### Features +- ๐ŸŽธ add sourceMap prop to configuration object ([a2505da](https://github.com/sveltejs/svelte-preprocess/commit/a2505da88ba025040d7069fd499c4d759a1fcb72)) +- ๐ŸŽธ support defining default languages ([d86122f](https://github.com/sveltejs/svelte-preprocess/commit/d86122f41a5616b7053dce26d7cf7c58ee025e1d)), closes [#189](https://github.com/sveltejs/svelte-preprocess/issues/189) +- ๐ŸŽธ support markup preprocessing with no tags ([290ef98](https://github.com/sveltejs/svelte-preprocess/commit/290ef98aad8a218880f5c511d11ad562e1869b35)) +- ๐ŸŽธ support prependData for almost every preprocessor ([ef5272e](https://github.com/sveltejs/svelte-preprocess/commit/ef5272eceae1237af26d18aaf209ec68c6c43c6e)) +### BREAKING CHANGES -## [3.9.11](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.10...v3.9.11) (2020-07-01) +- ๐Ÿงจ This is a general evolution of the specific `scss.data` property that + was used to prepend data to components written in scss. + `{preprocessorOptions}.prependData` is now the way to prepend some + string to any preprocessor. +- ๐Ÿงจ Node versions below 9.11.2 won't be supported anymore +- ๐Ÿงจ Uses Lookbehind assertions, so Node 9.11.2+ is needed +- ๐Ÿงจ Content passed through the `data` property won't be prepended anymore. +- ๐Ÿงจ `onBefore` and `transformers` were removed +## [3.9.12](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.11...v3.9.12) (2020-07-05) ### Bug Fixes -* ๐Ÿ› log a warning if local external file is not found ([774aece](https://github.com/kaisermann/svelte-preprocess/commit/774aece08a5279a51707d3f428836169fc7735de)), closes [#174](https://github.com/kaisermann/svelte-preprocess/issues/174) +- ๐Ÿ› set bare option to true ([312bbb9](https://github.com/kaisermann/svelte-preprocess/commit/312bbb9bbf2668e1750296dbfc8b83bb39f291e8)) +## [3.9.11](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.10...v3.9.11) (2020-07-01) +### Bug Fixes -## [3.9.10](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.9...v3.9.10) (2020-06-22) +- ๐Ÿ› log a warning if local external file is not found ([774aece](https://github.com/kaisermann/svelte-preprocess/commit/774aece08a5279a51707d3f428836169fc7735de)), closes [#174](https://github.com/kaisermann/svelte-preprocess/issues/174) +## [3.9.10](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.9...v3.9.10) (2020-06-22) ### Bug Fixes -* remove extra identation for sass content ([7d0f437](https://github.com/kaisermann/svelte-preprocess/commit/7d0f4376037d1ff6b426e2d6882adb6b08d95464)) - - +- remove extra identation for sass content ([7d0f437](https://github.com/kaisermann/svelte-preprocess/commit/7d0f4376037d1ff6b426e2d6882adb6b08d95464)) ## [3.9.9](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.7...v3.9.9) (2020-06-19) - ### Bug Fixes -* ๐Ÿ› prevent including external file if content is not empty ([24e90d1](https://github.com/kaisermann/svelte-preprocess/commit/24e90d101103b043d4b9e9789d2d6582ecf31ae8)), closes [#183](https://github.com/kaisermann/svelte-preprocess/issues/183) -* ๐Ÿ› throw if type errors are found ([6545a5c](https://github.com/kaisermann/svelte-preprocess/commit/6545a5c13ff81a568714cbd83ae2d6127d4f61a4)), closes [#182](https://github.com/kaisermann/svelte-preprocess/issues/182) - - +- ๐Ÿ› prevent including external file if content is not empty ([24e90d1](https://github.com/kaisermann/svelte-preprocess/commit/24e90d101103b043d4b9e9789d2d6582ecf31ae8)), closes [#183](https://github.com/kaisermann/svelte-preprocess/issues/183) +- ๐Ÿ› throw if type errors are found ([6545a5c](https://github.com/kaisermann/svelte-preprocess/commit/6545a5c13ff81a568714cbd83ae2d6127d4f61a4)), closes [#182](https://github.com/kaisermann/svelte-preprocess/issues/182) ## [3.9.8](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.7...v3.9.8) (2020-06-17) - ### Bug Fixes -* ๐Ÿ› prevent including external file if content is not empty ([fd1b55a](https://github.com/kaisermann/svelte-preprocess/commit/fd1b55a557eb4db43adb4af3a3c8be63584f7288)), closes [#183](https://github.com/kaisermann/svelte-preprocess/issues/183) - - +- ๐Ÿ› prevent including external file if content is not empty ([fd1b55a](https://github.com/kaisermann/svelte-preprocess/commit/fd1b55a557eb4db43adb4af3a3c8be63584f7288)), closes [#183](https://github.com/kaisermann/svelte-preprocess/issues/183) ## [3.9.7](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.6...v3.9.7) (2020-06-10) - ### Bug Fixes -* ๐Ÿ› attributes not being passed to transformers ([840239d](https://github.com/kaisermann/svelte-preprocess/commit/840239d225f1ef0b7b642830093a8b6745d11ceb)), closes [#175](https://github.com/kaisermann/svelte-preprocess/issues/175) -* quotes in the release script ([#173](https://github.com/kaisermann/svelte-preprocess/issues/173)) ([5550b3e](https://github.com/kaisermann/svelte-preprocess/commit/5550b3eea390148e9e5683ec214bddae7531a405)) - - +- ๐Ÿ› attributes not being passed to transformers ([840239d](https://github.com/kaisermann/svelte-preprocess/commit/840239d225f1ef0b7b642830093a8b6745d11ceb)), closes [#175](https://github.com/kaisermann/svelte-preprocess/issues/175) +- quotes in the release script ([#173](https://github.com/kaisermann/svelte-preprocess/issues/173)) ([5550b3e](https://github.com/kaisermann/svelte-preprocess/commit/5550b3eea390148e9e5683ec214bddae7531a405)) ## [3.9.6](https://github.com/kaisermann/svelte-preprocess/compare/v3.9.4...v3.9.6) (2020-06-06) diff --git a/README.md b/README.md index 3b3facf5..755d3fbd 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,55 @@ -![](https://github.com/kaisermann/svelte-preprocess/workflows/CI/badge.svg) - # Svelte Preprocess -> A [Svelte](https://svelte.dev) preprocessor with support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript and Pug. +> A [Svelte](https://svelte.dev) preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, CoffeeScript, TypeScript, Pug and much more. + +

+ + npm version + + + + license + - - + + action-CI + +

-- [Installation](#installation) +- [What is it?](#what-is-it) +- [Getting Started](docs/getting-started.md) +- [Usage](docs/usage.md) +- [Migration Guide](docs/migration-guide.md) +- [Preprocessing](docs/preprocessing.md) + - [Preprocessors](docs/preprocessing.md#preprocessors) - [Features](#features) - [Template tag](#template-tag) - [External files](#external-files) - [Global style](#global-style) - - [Global rule](#global-rule) - - [Preprocessors](#preprocessors) - - [Modern Javascript syntax](#modern-javascript-syntax) + - [Modern JavaScript syntax](#modern-javascript-syntax) - [Replace values](#replace-values) -- [Usage](#usage) - - [With `rollup-plugin-svelte`](#with-rollup-plugin-svelte) - - [With `svelte-loader`](#with-svelte-loader) - - [With Sapper](#with-sapper) - - [With Svelte VS Code](#with-svelte-vs-code) -- [Preprocessing modes](#preprocessing-modes) - - [Auto Preprocessing](#auto-preprocessing) - - [Standalone processors](#standalone-processors) -- [Options](#options) -- [Specifics and limitations](#specifics-and-limitations) - - [`scss`/`sass`](#scsssass) - - [`typescript`](#typescript) - - [`pug`](#pug) - - [`coffeescript`](#coffeescript) -- [FAQ](#faq) - - [My VS Code is displaying a lot of errors on my templates when I try to use `x`...](#my-vs-code-is-displaying-a-lot-of-errors-on-my-templates-when-i-try-to-use-x) - - [My `typescript` compilation is sloooooooow](#my-typescript-compilation-is-sloooooooow) - - - -## Installation - -`npm install -D svelte-preprocess` - -The preprocessor module installation is up to the developer. - -- `babel`: `npm install -D @babel/core @babel/preset-...` -- `coffeescript`: `npm install -D coffeescript` -- `typescript`: `npm install -D typescript` -- `postcss`: `npm install -D postcss postcss-load-config` -- `less`: `npm install -D less` -- `sass`: `npm install -D node-sass` or `npm install -D sass` -- `pug`: `npm install -D pug` -- `stylus`: `npm install -D stylus` - -_Note: If you want to load your `postcss` configuration from a external file, make sure to also install `postcss-load-config`._ + - [Built-in support for commonly used languages](#built-in-support-for-commonly-used-languages) + +## What is it? + +`Svelte`'s own parser understands only JavaScript, CSS and its HTML-like syntax. To make it possible to write components in other languages, such as TypeScript or SCSS, `Svelte` provides the [preprocess API](https://svelte.dev/docs#svelte_preprocess), which allows to easily transform the content of your `markup` and your `style`/`script` tags. + +Writing your own preprocessor for, i.e SCSS is easy enough, but it can be cumbersome to have to always configure multiple preprocessors for the languages you'll be using. + +`svelte-preprocess` is a custom svelte preprocessor that acts as a facilitator to use other languages with Svelte, providing multiple features, sensible defaults and a less noisy development experience. + +```js +import svelte from 'rollup-plugin-svelte' +import autoPreprocess from 'svelte-preprocess' + +export default { + plugins: [ + svelte({ + preprocess: autoPreprocess({ ... }) + }) + ] +} +``` ## Features @@ -59,7 +57,7 @@ _Note: If you want to load your `postcss` configuration from a external file, ma Add _vue-like_ support for defining your markup between a `