Skip to content

Commit 725b4d8

Browse files
committed
Update README, CHANGELOG and up version
1 parent 473033e commit 725b4d8

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v0.0.8
2+
3+
## Added
4+
- `:build_stylesheet_definitions_json_task` config option to run a task for building missing stylesheet definitions JSON file when using `:embed_stylsheet` (/DefactoSoftware/ex_css_modules/pull/#112).
5+
16
# v0.0.7
27

38
## Added

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,26 @@
77

88
ExCSSModules defines two ways to read the stylesheet: embedded and read.
99

10-
If you set the `embed_stylesheet` option to the `use` macro the stylesheet definitions JSON have to be compiled before the application is compiled. This flag is used for production to optimize read times.
10+
If you set the `embed_stylesheet` option to the `use` macro the stylesheet definitions JSON have to be compiled before the application is compiled. This flag is used for production to optimize read times. Additionally, you can add a task to generate missing stylesheet definitions JSON files when compiling ExCSSModules, to prevent compilation errors when one of the stylesheet definitions JSON might be missing:
11+
12+
```ex
13+
defmodule Mix.Tasks.GenerateMissingJson do
14+
use Mix.Task
15+
16+
@impl Mix.Task
17+
18+
def run(filename) do
19+
with _exit_code = 0 <-
20+
Mix.shell().cmd("npx postcss #{filename} --dir ./tmp/postcss --verbose") do
21+
{:ok, filename <> ".json"}
22+
else
23+
_exit_code ->
24+
relative_path = Path.relative_to_cwd(filename)
25+
exit("Error generating scoped JSON file ./#{relative_path}.json")
26+
end
27+
end
28+
end
29+
```
1130

1231
If you don't set the flag or set it to false, the stylesheet definition JSON files are read live from the server which creates a lot of IO for each request.
1332

@@ -16,7 +35,7 @@ Install from [Hex.pm](https://hex.pm/packages/ex_css_modules):
1635

1736
```ex
1837
def deps do
19-
[{:ex_css_modules, "~> 0.0.7"}]
38+
[{:ex_css_modules, "~> 0.0.8"}]
2039
end
2140
```
2241

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule ExCSSModules.Mixfile do
22
use Mix.Project
33

4-
@version "0.0.7"
4+
@version "0.0.8"
55

66
def project do
77
[

0 commit comments

Comments
 (0)