Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update dart-sass to 1.81.0, enhance makefile performance #169

Merged
merged 4 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Dev Build

on:
push:
branches:
- dev**
pull_request:
types: [opened, synchronize, reopened]

env:
DART_SASS_VERSION: 1.79.6
DART_SASS_VERSION: 1.81.0

jobs:
compile:
Expand All @@ -25,10 +22,12 @@ jobs:
extract: true
- name: Add Binary to PATH
run: |
ln -s "$GITHUB_WORKSPACE/dart-sass/sass" "$GITHUB_WORKSPACE/dart-sass/dart-sass"
echo "$GITHUB_WORKSPACE/dart-sass" >> "$GITHUB_PATH"
- name: Compile
run: |
cd ./src; make
cd ./src
make -j3
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- v*

env:
DART_SASS_VERSION: 1.79.6
DART_SASS_VERSION: 1.81.0

jobs:
release:
Expand All @@ -23,10 +23,12 @@ jobs:
extract: true
- name: Add Binary to PATH
run: |
ln -s "$GITHUB_WORKSPACE/dart-sass/sass" "$GITHUB_WORKSPACE/dart-sass/dart-sass"
echo "$GITHUB_WORKSPACE/dart-sass" >> "$GITHUB_PATH"
- name: Compile
run: |
cd ./src; make all-and-compress
cd ./src
make all-and-compress -j3
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
Expand Down
14 changes: 4 additions & 10 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ define build
mkdir -p $(target_dir)/$(1)-$(2)
mkdir -p $(target_dir)/$(1)-$(2)/target
if [ "$(3)" = "light" ]; then \
sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex.css; \
dart-sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex.css; \
else \
sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css; \
dart-sass --no-source-map --style expanded $(working_dir)/headers/$(1)/$(3).scss $(target_dir)/$(1)-$(2)/target/latex-$(3).css; \
fi
endef

Expand All @@ -46,19 +46,13 @@ define build-pandoc
endef

.PHONY: all
all:
make windows
make macos
make linux
make pandoc
all: windows macos linux

.PHONY: all-and-compress
all-and-compress:
make all
all-and-compress: all
cd $(target_dir)/$(windows)-$(typora); zip -r $(target_dir)/latex-theme-$(windows).zip ./*
cd $(target_dir)/$(macos)-$(typora); zip -r $(target_dir)/latex-theme-$(macos).zip ./*
cd $(target_dir)/$(linux)-$(typora); zip -r $(target_dir)/latex-theme-$(linux).zip ./*
# cd $(target_dir)/$(pandoc)-$(typora); zip -r $(target_dir)/latex-theme-$(pandoc).zip ./*

.PHONY: windows
windows:
Expand Down
5 changes: 1 addition & 4 deletions src/headers/linux/dark.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "linux";
$theme: "dark";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "linux", $theme: "dark");
5 changes: 1 addition & 4 deletions src/headers/linux/light.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "linux";
$theme: "light";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "linux", $theme: "light");
5 changes: 1 addition & 4 deletions src/headers/macos/dark.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "macos";
$theme: "dark";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "macos", $theme: "dark");
5 changes: 1 addition & 4 deletions src/headers/macos/light.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "macos";
$theme: "light";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "macos", $theme: "light");
5 changes: 1 addition & 4 deletions src/headers/windows/dark.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "windows";
$theme: "dark";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "windows", $theme: "dark");
5 changes: 1 addition & 4 deletions src/headers/windows/light.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
$os: "windows";
$theme: "light";

@import "../../scss/include.scss";
@use "../../scss/include.scss" with ($os: "windows", $theme: "light");
3 changes: 3 additions & 0 deletions src/scss/blockquote.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

/* 一个>的引言仅为两字符缩进,使用>>的引言为传统引言样式,具有左竖线、左缩进 */

blockquote {
Expand Down
3 changes: 3 additions & 0 deletions src/scss/code.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

/* 行内代码 */
code {
font-family: var(--code-font), var(--ui-font), monospace;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/dark.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

@if $theme == "dark" {
/* 可能的代码高亮样式
.cm-s-inner {
Expand Down
3 changes: 3 additions & 0 deletions src/scss/footnote.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

/* 参考文献(脚注)块 */
.footnotes {
font-size: 0.95em;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/heading.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

#write {
// 标题属性
h1,
Expand Down
25 changes: 14 additions & 11 deletions src/scss/include.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
@import "./settings.scss";
$os: "" !default;
$theme: "" !default;

@import "./text.scss";
@import "./typora.scss";
@use "./settings.scss" with ($os: $os, $theme: $theme);

@import "./heading.scss";
@import "./footnote.scss";
@import "./list.scss";
@import "./table.scss";
@import "./blockquote.scss";
@import "./code.scss";
@import "./toc.scss";
@use "./text.scss" with ($os: $os, $theme: $theme);
@use "./typora.scss" with ($os: $os, $theme: $theme);

@import "./dark.scss";
@use "./heading.scss" with ($os: $os, $theme: $theme);
@use "./footnote.scss" with ($os: $os, $theme: $theme);
@use "./list.scss" with ($os: $os, $theme: $theme);
@use "./table.scss" with ($os: $os, $theme: $theme);
@use "./blockquote.scss" with ($os: $os, $theme: $theme);
@use "./code.scss" with ($os: $os, $theme: $theme);
@use "./toc.scss" with ($os: $os, $theme: $theme);

@use "./dark.scss" with ($os: $os, $theme: $theme);
3 changes: 3 additions & 0 deletions src/scss/list.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

/* 无序列表 */
#write ul {
list-style: disc;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/settings.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

:root {
$ui-font: null;
$heading-Chinese-font: null;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/table.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

#write {
// 三线表
table {
Expand Down
3 changes: 3 additions & 0 deletions src/scss/text.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

body {
padding: 0 !important;
margin: 0 !important;
Expand Down
3 changes: 3 additions & 0 deletions src/scss/toc.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

/* 目录 */
.md-toc {
font-size: var(--toc-font-size);
Expand Down
3 changes: 3 additions & 0 deletions src/scss/typora.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$os: "" !default;
$theme: "" !default;

@media screen {
#write {
padding: var(--set-margin);
Expand Down