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

Use Dart Sass #8

Merged
merged 2 commits into from
Apr 12, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/public/
/resources/

*.css
*.css.map
*.scss.map

Expand Down
24 changes: 22 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,39 @@ jobs:
clean: all
timeoutInMinutes: 2
variables:
hugo_download_url: https://github.com/gohugoio/hugo/releases/download/v0.59.1/hugo_extended_0.59.1_Linux-64bit.tar.gz
hugo_download_url: https://github.com/gohugoio/hugo/releases/download/v0.59.1/hugo_0.59.1_Linux-64bit.tar.gz
hugo_archive: hugo.tar.gz
hugo_build_path: $(System.DefaultWorkingDirectory)/$(artifact_name)
sass_download_url: https://github.com/sass/dart-sass/releases/download/1.26.3/dart-sass-1.26.3-linux-x64.tar.gz
sass_archive: sass.tar.gz
sass_directory: $(hugo_build_path)/style
steps:
- bash: |
echo Downloading Hugo
wget --output-document $(hugo_archive) --tries 3 --no-verbose $(hugo_download_url)
tar -xzvf $(hugo_archive) hugo
rm $(hugo_archive)
./hugo version
echo Hugo `./hugo version`
- bash: |
echo Running Hugo
./hugo --destination $(hugo_build_path) --environment production --cleanDestinationDir --gc --ignoreCache --log --minify --noChmod
echo "Files and folders generated by Hugo:"
ls $(hugo_build_path)
- bash: |
echo Downloading Sass
wget --output-document $(sass_archive) --tries 3 --no-verbose $(sass_download_url)
tar --extract --gzip --verbose --file $(sass_archive)
mv dart-sass/* ./
rm $(sass_archive)
rm --dir dart-sass
echo Sass `./sass --version`
- bash: |
echo Running Sass
./sass $(sass_directory):$(sass_directory) --style=compressed --no-source-map --stop-on-error
- bash: |
rm $(sass_directory)/*.scss
echo "Files generated by Sass:"
ls $(sass_directory)
- publish: $(hugo_build_path)
artifact: $(artifact_name)

Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{{ hugo.Generator }}
{{ block "meta" . }} {{ end }}

{{ partial "scssLink" "style/style.scss" }}
{{ partial "scssLink" "style" }}
{{ block "includes" . }} {{ end }}
</head>

Expand Down
2 changes: 1 addition & 1 deletion layouts/about/section.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "includes" }}
{{ partial "scssLink" "style/about.scss" }}
{{ partial "scssLink" "about" }}
{{ end }}

{{ define "main" }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/about/single.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "includes" }}
{{ partial "scssLink" "style/about.scss" }}
{{ partial "scssLink" "about" }}
{{ end }}

{{ define "main" }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/articles/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{ end }}

{{ define "includes" }}
{{ partial "scssLink" "style/article.scss" }}
{{ partial "scssLink" "article" }}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-okaidia.min.css">
{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ end }}

{{ define "includes" }}
{{ partial "scssLink" "style/index.scss" }}
{{ partial "scssLink" "index" }}
{{ end }}

{{ define "main" }}
Expand Down
6 changes: 2 additions & 4 deletions layouts/partials/scssLink.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
{{ $options := dict "outputStyle" "compressed" "enableSourceMap" true }}
{{ $style := resources.Get . | resources.ToCSS $options }}
{{ $fingerprinted := $style | resources.Fingerprint "sha384" }}
<link rel="stylesheet" type="text/css" href="{{ $style.Permalink }}" integrity="{{ $fingerprinted.Data.Integrity }}">
{{ $href := print "style/" . ".css" | urlize | relURL }}
<link rel="stylesheet" type="text/css" href="{{ $href }}">
2 changes: 1 addition & 1 deletion layouts/resources/section.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ define "includes" }}
{{ partial "scssLink" "style/resources.scss" }}
{{ partial "scssLink" "resources" }}
{{ end }}

{{ define "main" }}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.