-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): Export minified theme css for ui extensions dev
- Loading branch information
1 parent
fd7f9d1
commit 99073c9
Showing
4 changed files
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const sass = require('sass'); | ||
|
||
// Compiles the Admin UI styles into a css file for consumption by | ||
// non-Angular ui extensions. | ||
const outFile = path.join(__dirname, '../package/static/theme.min.css'); | ||
const result = sass.renderSync({ | ||
file: path.join(__dirname, '../src/lib/static/styles/theme.scss'), | ||
importer, | ||
includePaths: [path.join(__dirname, '../src/lib/static/styles')], | ||
outputStyle: 'compressed', | ||
outFile, | ||
}); | ||
|
||
fs.writeFileSync(outFile, result.css, 'utf8'); | ||
|
||
|
||
function importer(url, prev, done) { | ||
let file = url; | ||
// Handle the imports prefixed with ~ | ||
// which are usually resolved by Webpack. | ||
if (/^~@clr/.test(url)) { | ||
const sansTilde = url.substr(1); | ||
const fullPath = path.extname(sansTilde) === '' ? sansTilde + '.scss' : sansTilde; | ||
file = require.resolve(fullPath); | ||
} | ||
|
||
// Ignore the contents of the Angular-specific | ||
// library styles which are not needed in external | ||
// apps. | ||
if (/^~@(ng-select|angular)/.test(url)) { | ||
return false; | ||
} | ||
|
||
return { file }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
// Clarity Component SCSS | ||
@import "~@clr/ui/src/main"; | ||
@import "theme"; | ||
@import "~@clr/icons/clr-icons.min.css"; | ||
|
||
@import "theme/theme"; | ||
|
||
@import "~@ng-select/ng-select/themes/default.theme.css"; | ||
@import '~@angular/cdk/overlay-prebuilt.css'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// This file is used to compile the theme.min.css file which can be used | ||
// by ui extensions to get the same styles as the main app. | ||
|
||
// Clarity Component SCSS | ||
@import "~@clr/ui/src/main"; | ||
@import "theme/theme"; |