Skip to content

Commit

Permalink
chore(deps): use sass instead of sass-build
Browse files Browse the repository at this point in the history
  • Loading branch information
Juveniel committed Nov 28, 2024
1 parent 6e434b5 commit ffe9544
Show file tree
Hide file tree
Showing 39 changed files with 479 additions and 1,939 deletions.
7 changes: 2 additions & 5 deletions .github/disabled-workflows/ci_next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,5 @@ jobs:
- name: Ensure standalone build
run: npm run sass:standalone

- name: Build themes using node-sass (full)
run: npm run sass

- name: Build swatches using node-sass
run: npm run sass:swatches
- name: Build themes for dist
run: npm run sass:dist
3 changes: 0 additions & 3 deletions .github/workflows/_lint-styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@ jobs:
run: |
npm run stylelint
- name: Ensure standalone build
run: |
npm run sass:standalone --prefix packages/${{ matrix.theme }} --if-present
8 changes: 2 additions & 6 deletions .github/workflows/ci_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,9 @@ jobs:
run: |
npm run sass:standalone
- name: Build themes using node-sass (full)
- name: Build themes for dist
run: |
npm run sass
- name: Build swatches using node-sass
run: |
npm run sass:swatches
npm run sass:dist
- name: Build docs
run: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ jobs:

- name: Build themes for dist
run: |
npm run sass
npm run sass:swatches
npm run sass:dist
npm run docs
- name: Lerna publish
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish_npm_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ jobs:

- name: Build themes for dist
run: |
npm run sass
npm run sass:swatches
npm run sass:dist
npm run docs
- name: Lerna publish
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ jobs:

- name: Build themes for dist
run: |
npm run sass
npm run sass:swatches
npm run sass:dist
npm run docs
- name: Pack nuget
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/publish_swatches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ jobs:
if: steps.cache-root-node_modules.outputs.cache-hit != 'true'
run: npm ci --no-audit --no-fund

- name: Build swatches
- name: Build themes for dist
run: |
npm run sass
npm run sass:swatches
npm run sass:dist
- name: Checkout artifact repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To run it, execute `npm start` and navigate to <http://localhost:3000/>
The following npm commands are available for building the themes:

* To build all themes run `npm run sass`.
* To build all swatches run `npm run sass:swatches`.
* To build all swatches run `npm run sass:dist`.

There are additional commands, which can be found in [`package.json`](package.json) and [`gulpfile.js`](gulpfile.js).

Expand Down
53 changes: 32 additions & 21 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ const path = require("path");

const { globSync } = require("glob");
const gulp = require("gulp");
const sass = require('sass');

// Settings
const paths = {
sass: {
all: "packages/*/scss/**/*.scss",
assets: "packages/*/scss/**/*.{png,gif,ttf,woff}",
themes: "packages/!(html)",
themes: "packages/!(html|nouvelle)",
theme: "scss/all.scss",
swatches: "lib/swatches/*.json",
inline: "dist/all.scss",
standalone: "scss/**/_index.scss",
dist: "dist"
}
};
Expand All @@ -26,11 +25,10 @@ function getArg(key, argsArr) {
}

// #region helpers
function flattenAll( cwds, options ) {

function copyFilesToDist( cwds, options ) {
const fileContent = `@forward "../scss/index.scss";\n@use "../scss/index.scss" as *;\n\n@include kendo-theme--styles();`

const utilsFileContent = `@use "../scss/index.import.scss" as *;\n\n@include kendo-utils();`
const coreFileContent = `@use "../scss/index.scss" as *;\n\n@include core-styles();`

cwds.forEach( cwd => {
let file = path.resolve( cwd, options.file );
Expand All @@ -41,25 +39,16 @@ function flattenAll( cwds, options ) {

if ( cwd.includes('utils') ) {
fs.writeFileSync(path.resolve( output.path, output.filename ), utilsFileContent);
} else {
} else if ( cwd.includes('core') ) {
fs.writeFileSync(path.resolve( output.path, output.filename ), coreFileContent);
}else {
fs.writeFileSync( path.resolve( output.path, output.filename), fileContent);
}

}
});
};

function distAll() {
let file = paths.sass.theme;
let output = { path: paths.sass.dist };
let themes = globSync( paths.sass.themes );

flattenAll( themes, { file, output } );

return Promise.resolve();
}
gulp.task("dist:all", distAll);

function writeSwatches( cwds, options ) {

cwds.forEach( cwd => {
Expand Down Expand Up @@ -167,16 +156,38 @@ function swatchJsonTransformer( json ) {
}
// #endregion


// #region dist
function distSwatches() {
let output = { path: getArg('--output-path') || paths.sass.dist };
let file = paths.sass.theme;
let output = { path: paths.sass.dist };
let themes = globSync( getArg('--theme') || paths.sass.themes );
let swatches = paths.sass.swatches;

copyFilesToDist( themes, { file, output } );
writeSwatches( themes, { swatches, output } );

return Promise.resolve();
}
gulp.task("dist:swatches", distSwatches);
// #endregion

// #region compile
function buildStandalone() {
let themes = globSync( getArg('--theme') || paths.sass.themes );

themes.forEach( theme => {
let fileGlob = path.resolve( theme, "scss/**/_index.scss" ).split(path.sep).join(path.posix.sep);
let files = globSync( fileGlob );

files.forEach( file => {
sass.compile(file, {
sourceMap: false,
loadPaths: ["node_modules"]
});
});
})

return Promise.resolve();
}
gulp.task("sass:standalone", buildStandalone);
// #endregion
Loading

0 comments on commit ffe9544

Please sign in to comment.