diff --git a/internal/documentation/docs/pages/Server.md b/internal/documentation/docs/pages/Server.md index 64d6ae46155..0f30164d298 100644 --- a/internal/documentation/docs/pages/Server.md +++ b/internal/documentation/docs/pages/Server.md @@ -54,7 +54,7 @@ The remote-connections warning (when `--accept-remote-connections` is used) is w ## Standard Middleware ::: info Removed Middleware -The `serveThemes` middleware has been removed in UI5 CLI v5. Theme compilation is now handled by the `buildThemes` build task, which pre-compiles all theme CSS files. The resulting CSS files (including `library.css`, `library-RTL.css`, `library-parameters.json`, and CSS Variables resources) are served via the `serveResources` middleware, providing the same functionality with better performance through build-time compilation and caching. +The `serveThemes` middleware has been removed in UI5 CLI v5. Theme compilation is now handled by the `buildThemes` build task, which pre-compiles all theme CSS files. The resulting CSS files (including `library.css`, `library-RTL.css`, `library-parameters.json`) are served via the `serveResources` middleware, providing the same functionality with better performance through build-time compilation and caching. The `testRunner` middleware has also been removed in UI5 CLI v5. The QUnit TestRunner (`testrunner.html`, `testrunner.css`, `TestRunner.js`) is now provided by the UI5 framework (`sap.ui.core`) and is served via the `serveResources` middleware. diff --git a/internal/documentation/docs/updates/migrate-v5.md b/internal/documentation/docs/updates/migrate-v5.md index c9db7b58dac..a766e924d80 100644 --- a/internal/documentation/docs/updates/migrate-v5.md +++ b/internal/documentation/docs/updates/migrate-v5.md @@ -27,6 +27,8 @@ Or update your global install via: `npm i --global @ui5/cli@next` - **@ui5/cli: `ui5 serve` renders a status banner in interactive terminals** +- **@ui5/cli: Option `--experimental-css-variables` has been removed** + ## Node.js and npm Version Support @@ -320,6 +322,13 @@ Update your `ui5.yaml` configuration to reference an existing middleware instead | `serveThemes` | CSS files pre-built by `buildThemes` task and served via `serveResources` | `serveResources` | | `testRunner` | TestRunner resources served via `serveResources` from the UI5 framework | `serveResources` | +## Removal of `--experimental-css-variables` + +The SAP Theme Designer can create custom themes based on CSS variables instead of LESS variables. To establish a consistent and standardized approach to theme customization, this feature will no longer be supported in UI5 CLI. + +With UI5 CLI v5, the `--experimental-css-variables` option has therefore been removed for the `ui5 build` command. For custom theme creation with CSS variables, please check out the **SAP Theme Designer**. + + ## Learn More - [Project: Type `component`](../pages/Project#component) diff --git a/packages/builder/lib/processors/themeBuilder.js b/packages/builder/lib/processors/themeBuilder.js index 2a4a760b90c..6d8ca10ad6a 100644 --- a/packages/builder/lib/processors/themeBuilder.js +++ b/packages/builder/lib/processors/themeBuilder.js @@ -36,12 +36,9 @@ export class ThemeBuilder { * @param {@ui5/fs/Resource[]} resources Library files * @param {object} [options] Build options * @param {boolean} [options.compress=false] Compress build output (CSS / JSON) - * @param {boolean} [options.cssVariables=false] Generates the CSS variables - * (css-variables.css, css-variables.source.less) and the skeleton for a theme - * (library-skeleton.css, [library-skeleton-RTL.css]) * @returns {Promise<@ui5/fs/Resource[]>} Resolving with array of created files */ - build(resources, {compress = false, cssVariables = false} = {}) { + build(resources, {compress = false} = {}) { const files = []; const compile = (resource) => { @@ -61,7 +58,6 @@ export class ThemeBuilder { compiler: { compress }, - cssVariables }).then((result) => { const themeDir = posixPath.dirname(resource.getPath()); @@ -81,27 +77,6 @@ export class ThemeBuilder { }); files.push(libCss, libCssRtl, libParams); - - if (cssVariables) { - const libCssVarsSource = new Resource({ - path: themeDir + "/css_variables.source.less", - string: result.cssVariablesSource - }); - const libCssVars = new Resource({ - path: themeDir + "/css_variables.css", - string: result.cssVariables - }); - const libCssSkel = new Resource({ - path: themeDir + "/library_skeleton.css", - string: result.cssSkeleton - }); - const libCssSkelRtl = new Resource({ - path: themeDir + "/library_skeleton-RTL.css", - string: result.cssSkeletonRtl - }); - - files.push(libCssVarsSource, libCssVars, libCssSkel, libCssSkelRtl); - } }, (err) => { log.error(`Error while compiling ${resource.getPath()}: ${err.message}`); throw err; @@ -130,9 +105,6 @@ export class ThemeBuilder { * @public * @typedef {object} ThemeBuilderOptions * @property {boolean} [compress=false] Compress build output (CSS / JSON) - * @property {boolean} [cssVariables=false] Generates the CSS variables - * (css-variables.css, css-variables.source.less) and the skeleton for a theme - * (library-skeleton.css, [library-skeleton-RTL.css]) */ /** @@ -156,12 +128,11 @@ export default async function({ fs, options = {} }) { - const {compress, cssVariables} = + const {compress} = /** @type {module:@ui5/builder/processors/ThemeBuilder~ThemeBuilderOptions} */ (options); const themeBuilder = new ThemeBuilder({fs}); return themeBuilder.build(resources, { compress, - cssVariables }).then((files) => { themeBuilder.clearCache(); return files; diff --git a/packages/builder/lib/tasks/buildThemes.js b/packages/builder/lib/tasks/buildThemes.js index de9f2e4d6fe..c11b3435a88 100644 --- a/packages/builder/lib/tasks/buildThemes.js +++ b/packages/builder/lib/tasks/buildThemes.js @@ -84,14 +84,12 @@ async function buildThemeInWorker(taskUtil, options, transferList) { * @param {string} [parameters.options.librariesPattern] Search pattern for .library files * @param {string} [parameters.options.themesPattern] Search pattern for sap.ui.core theme folders * @param {boolean} [parameters.options.compress=true] - * @param {boolean} [parameters.options.cssVariables=false] * @returns {Promise} Promise resolving with undefined once data has been written */ export default async function({ workspace, dependencies, taskUtil, options: { projectName, inputPattern, librariesPattern, themesPattern, compress, - cssVariables } }) { const combo = new ReaderCollectionPrioritized({ @@ -205,7 +203,6 @@ export default async function({ themeResources: await serializeResources([themeRes]), options: { compress, - cssVariables: !!cssVariables, }, }, [port2]); @@ -226,7 +223,6 @@ export default async function({ fs: fsInterface(combo), options: { compress, - cssVariables: !!cssVariables, } }); } diff --git a/packages/builder/lib/tasks/generateThemeDesignerResources.js b/packages/builder/lib/tasks/generateThemeDesignerResources.js index df1fe466278..d2f9b60bdf7 100644 --- a/packages/builder/lib/tasks/generateThemeDesignerResources.js +++ b/packages/builder/lib/tasks/generateThemeDesignerResources.js @@ -7,37 +7,6 @@ import ReaderCollectionPrioritized from "@ui5/fs/ReaderCollectionPrioritized"; import Resource from "@ui5/fs/Resource"; import fsInterface from "@ui5/fs/fsInterface"; -/** - * Returns a relative path from the given themeFolder to the root namespace. - * - * When combining the given themeFolder with the returned relative path it - * resolves to "/resources/". However the "/resources/" part is not important - * here as it doesn't exist within the theming engine environment where the - * UI5 resources are part of a "UI5" folder (e.g. "UI5/sap/ui/core/") that - * is next to a "Base" folder. - * - * @example - * getPathToRoot("/resources/sap/ui/foo/themes/base") - * > "../../../../../" - * - * @param {string} themeFolder Virtual path including /resources/ - * @returns {string} Relative path to root namespace - */ -function getPathToRoot(themeFolder) { - // -2 for initial "/"" and "resources/" - return "../".repeat(themeFolder.split("/").length - 2); -} - -/** - * Generates an less import statement for the given filePath - * - * @param {string} filePath The path to the desired file - * @returns {string} The less import statement - */ -function lessImport(filePath) { - return `@import "${filePath}";\n`; -} - function generateLibraryDotTheming({namespace, version, hasThemes}) { const dotTheming = { sEntity: "Library", @@ -53,7 +22,6 @@ function generateLibraryDotTheming({namespace, version, hasThemes}) { dotTheming.aFiles = [ "library", "global", // Additional entry compared to UI5 root .theming - "css_variables", ]; } if (!hasThemes) { @@ -119,82 +87,6 @@ async function generateThemeDotTheming({workspace, combo, themeFolder}) { return newDotThemingResource; } -async function createCssVariablesLessResource({workspace, combo, themeFolder}) { - const pathToRoot = getPathToRoot(themeFolder); - const cssVariablesSourceLessFile = "css_variables.source.less"; - const cssVariablesLessFile = "css_variables.less"; - - // posix as it is a virtual path (separated with /) - const themeName = posixPath.basename(themeFolder); - // The "base" theme of the baseLib is called "baseTheme" - const baseLibThemeName = themeName === "base" ? "baseTheme" : themeName; - - // Some themes do not have a base.less file (e.g. sap_hcb) - const hasBaseLess = !!(await combo.byPath(`/resources/sap/ui/core/themes/${themeName}/base.less`)); - - let cssVariablesLess = -`/* NOTE: This file was generated as an optimized version of "${cssVariablesSourceLessFile}" \ -for the Theme Designer. */\n\n`; - - if (themeName !== "base") { - const cssVariablesSourceLessResource = await workspace.byPath( - posixPath.join(themeFolder, cssVariablesSourceLessFile) - ); - - if (!cssVariablesSourceLessResource) { - throw new Error(`Could not find file "${cssVariablesSourceLessFile}" in theme "${themeFolder}"`); - } - - const cssVariablesSourceLess = await cssVariablesSourceLessResource.getString(); - - cssVariablesLess += lessImport(`../base/${cssVariablesLessFile}`); - cssVariablesLess += ` -/* START "${cssVariablesSourceLessFile}" */ -${cssVariablesSourceLess} -/* END "${cssVariablesSourceLessFile}" */ - -`; - } - - if (hasBaseLess) { - cssVariablesLess += lessImport(`${pathToRoot}../Base/baseLib/${baseLibThemeName}/base.less`); - } - cssVariablesLess += lessImport(`${pathToRoot}sap/ui/core/themes/${themeName}/global.less`); - - return new Resource({ - path: posixPath.join(themeFolder, cssVariablesLessFile), - string: cssVariablesLess - }); -} - -async function generateCssVariablesLess({workspace, combo, namespace}) { - let cssVariablesSourceLessResourcePattern; - if (namespace) { - // In case of a library only check for themes directly below the namespace - cssVariablesSourceLessResourcePattern = `/resources/${namespace}/themes/*/css_variables.source.less`; - } else { - // In case of a theme-library check for all "themes" - cssVariablesSourceLessResourcePattern = `/resources/**/themes/*/css_variables.source.less`; - } - - const cssVariablesSourceLessResource = await workspace.byGlob(cssVariablesSourceLessResourcePattern); - - const hasCssVariables = cssVariablesSourceLessResource.length > 0; - - if (hasCssVariables) { - await Promise.all( - cssVariablesSourceLessResource.map(async (cssVariableSourceLess) => { - const themeFolder = posixPath.dirname(cssVariableSourceLess.getPath()); - log.verbose(`Generating css_variables.less for theme ${themeFolder}`); - const r = await createCssVariablesLessResource({ - workspace, combo, themeFolder - }); - return await workspace.write(r); - }) - ); - } -} - /** * @public * @module @ui5/builder/tasks/generateThemeDesignerResources @@ -311,7 +203,4 @@ export default async function({workspace, dependencies, options}) { await Promise.all( libraryLessResources.map((resource) => workspace.write(resource)) ); - - // css_variables.less - await generateCssVariablesLess({workspace, combo, namespace}); } diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/.theming b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/.theming deleted file mode 100644 index 4878adda883..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/.theming +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sEntity": "Theme", - "sId": "somefancytheme", - "sVendor": "SAP", - "oExtends": "base" -} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/Button.less b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/Button.less deleted file mode 100644 index ca968183f77..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/Button.less +++ /dev/null @@ -1,3 +0,0 @@ -.someClass { - color: @someColor -} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.css b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.css deleted file mode 100644 index 6232d9e3503..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.css +++ /dev/null @@ -1,3 +0,0 @@ -:root{--someColor:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.less b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.less deleted file mode 100644 index 91ce286944d..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.less +++ /dev/null @@ -1,14 +0,0 @@ -/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../base/css_variables.less"; - -/* START "css_variables.source.less" */ -@someColor: #000000; - -:root { ---someColor: @someColor; -} - -/* END "css_variables.source.less" */ - -@import "../../../../sap/ui/core/themes/somefancytheme/global.less"; diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.source.less b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.source.less deleted file mode 100644 index 5a6ce08e9f9..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/css_variables.source.less +++ /dev/null @@ -1,5 +0,0 @@ -@someColor: #000000; - -:root { ---someColor: @someColor; -} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-RTL.css b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-RTL.css deleted file mode 100644 index 5009ca50e51..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-RTL.css +++ /dev/null @@ -1,3 +0,0 @@ -.someClass{color:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-parameters.json b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-parameters.json deleted file mode 100644 index a190cda03f6..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library-parameters.json +++ /dev/null @@ -1 +0,0 @@ -{"someColor":"#000"} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.css b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.css deleted file mode 100644 index 5009ca50e51..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.css +++ /dev/null @@ -1,3 +0,0 @@ -.someClass{color:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.less b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.less deleted file mode 100644 index 24c4ca167cb..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.less +++ /dev/null @@ -1,10 +0,0 @@ -/* NOTE: This file was generated as an optimized version of "library.source.less" for the Theme Designer. */ - -@someColor: black; -/* START "Button.less" */ -.someClass { - color: @someColor -} - -/* END "Button.less" */ - diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.source.less b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.source.less deleted file mode 100644 index 834de919e23..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library.source.less +++ /dev/null @@ -1,2 +0,0 @@ -@someColor: black; -@import "Button.less"; diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css deleted file mode 100644 index 7db08628997..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css +++ /dev/null @@ -1 +0,0 @@ -.someClass{color:var(--someColor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton.css b/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton.css deleted file mode 100644 index 7db08628997..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables-theme-designer-resources/resources/theme/j/themes/somefancytheme/library_skeleton.css +++ /dev/null @@ -1 +0,0 @@ -.someClass{color:var(--someColor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/Button.less b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/Button.less deleted file mode 100644 index ca968183f77..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/Button.less +++ /dev/null @@ -1,3 +0,0 @@ -.someClass { - color: @someColor -} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.css b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.css deleted file mode 100644 index 6232d9e3503..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.css +++ /dev/null @@ -1,3 +0,0 @@ -:root{--someColor:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.source.less b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.source.less deleted file mode 100644 index 5a6ce08e9f9..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/css_variables.source.less +++ /dev/null @@ -1,5 +0,0 @@ -@someColor: #000000; - -:root { ---someColor: @someColor; -} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-RTL.css b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-RTL.css deleted file mode 100644 index 5009ca50e51..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-RTL.css +++ /dev/null @@ -1,3 +0,0 @@ -.someClass{color:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-parameters.json b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-parameters.json deleted file mode 100644 index a190cda03f6..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library-parameters.json +++ /dev/null @@ -1 +0,0 @@ -{"someColor":"#000"} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.css b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.css deleted file mode 100644 index 5009ca50e51..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.css +++ /dev/null @@ -1,3 +0,0 @@ -.someClass{color:#000} -/* Inline theming parameters */ -#sap-ui-theme-theme\.j{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000%22%7D')} diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.source.less b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.source.less deleted file mode 100644 index 834de919e23..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library.source.less +++ /dev/null @@ -1,2 +0,0 @@ -@someColor: black; -@import "Button.less"; diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css deleted file mode 100644 index 7db08628997..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton-RTL.css +++ /dev/null @@ -1 +0,0 @@ -.someClass{color:var(--someColor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton.css b/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton.css deleted file mode 100644 index 7db08628997..00000000000 --- a/packages/builder/test/expected/build/theme.j/dest-css-variables/resources/theme/j/themes/somefancytheme/library_skeleton.css +++ /dev/null @@ -1 +0,0 @@ -.someClass{color:var(--someColor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theme b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theme deleted file mode 100644 index 4b4b1cf98f2..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theme +++ /dev/null @@ -1,9 +0,0 @@ - - - - my_theme - me - Some fancy copyright - 1.0.0 - - \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theming b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theming deleted file mode 100644 index 184073476c5..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/.theming +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sEntity": "Theme", - "sId": "my_theme", - "sVendor": "SAP", - "oExtends": "base" -} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.css deleted file mode 100644 index 48bb66a3e21..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.css +++ /dev/null @@ -1,3 +0,0 @@ -:root{--mycolor:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.less deleted file mode 100644 index 41b1dc48ed6..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.less +++ /dev/null @@ -1,14 +0,0 @@ -/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../base/css_variables.less"; - -/* START "css_variables.source.less" */ -@mycolor: #0000ff; - -:root { ---mycolor: @mycolor; -} - -/* END "css_variables.source.less" */ - -@import "../../../../../sap/ui/core/themes/my_theme/global.less"; diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.source.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.source.less deleted file mode 100644 index 28ed8727ae6..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/css_variables.source.less +++ /dev/null @@ -1,5 +0,0 @@ -@mycolor: #0000ff; - -:root { ---mycolor: @mycolor; -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-RTL.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-RTL.css deleted file mode 100644 index 5eac03f06d0..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-RTL.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-parameters.json b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-parameters.json deleted file mode 100644 index a0c4913800e..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library-parameters.json +++ /dev/null @@ -1 +0,0 @@ -{"mycolor":"#00f"} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.css deleted file mode 100644 index 5eac03f06d0..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.less deleted file mode 100644 index f3fda6d3e8f..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.less +++ /dev/null @@ -1,11 +0,0 @@ -/* NOTE: This file was generated as an optimized version of "library.source.less" for the Theme Designer. */ - -/*! - * Some fancy copyright - */ - -@mycolor: blue; - -.sapUiBody { - background-color: @mycolor; -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.source.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.source.less deleted file mode 100644 index d864e666dd4..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library.source.less +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * Some fancy copyright - */ - -@mycolor: blue; - -.sapUiBody { - background-color: @mycolor; -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css deleted file mode 100644 index 654b3877e7c..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css +++ /dev/null @@ -1,3 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:var(--mycolor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton.css deleted file mode 100644 index 654b3877e7c..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/resources/theme/library/e/themes/my_theme/library_skeleton.css +++ /dev/null @@ -1,3 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:var(--mycolor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/test-resources/theme/library/e/Test.html b/packages/builder/test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources/test-resources/theme/library/e/Test.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theme b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theme deleted file mode 100644 index 4b4b1cf98f2..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theme +++ /dev/null @@ -1,9 +0,0 @@ - - - - my_theme - me - Some fancy copyright - 1.0.0 - - \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theming b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theming deleted file mode 100644 index 83b6c785a87..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/.theming +++ /dev/null @@ -1,27 +0,0 @@ -{ - "sEntity": "Theme", - "sId": "sap_belize", - "oExtends": "base", - "sVendor": "SAP", - "aBundled": ["sap_belize_plus"], - "mCssScopes": { - "library": { - "sBaseFile": "library", - "sEmbeddingMethod": "APPEND", - "aScopes": [ - { - "sLabel": "Contrast", - "sSelector": "sapContrast", - "sEmbeddedFile": "sap_belize_plus.library", - "sEmbeddedCompareFile": "library", - "sThemeIdSuffix": "Contrast", - "sThemability": "PUBLIC", - "aThemabilityFilter": [ - "Color" - ], - "rExcludeSelector": "\\.sapContrastPlus\\W" - } - ] - } - } -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.css deleted file mode 100644 index 48bb66a3e21..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.css +++ /dev/null @@ -1,3 +0,0 @@ -:root{--mycolor:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.source.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.source.less deleted file mode 100644 index 28ed8727ae6..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/css_variables.source.less +++ /dev/null @@ -1,5 +0,0 @@ -@mycolor: #0000ff; - -:root { ---mycolor: @mycolor; -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-RTL.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-RTL.css deleted file mode 100644 index 5eac03f06d0..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-RTL.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-parameters.json b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-parameters.json deleted file mode 100644 index a0c4913800e..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library-parameters.json +++ /dev/null @@ -1 +0,0 @@ -{"mycolor":"#00f"} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.css deleted file mode 100644 index 5eac03f06d0..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.css +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:#00f} -/* Inline theming parameters */ -#sap-ui-theme-theme\.library\.e{background-image:url('data:text/plain;utf-8,%7B%22mycolor%22%3A%22%2300f%22%7D')} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.source.less b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.source.less deleted file mode 100644 index d864e666dd4..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library.source.less +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * Some fancy copyright - */ - -@mycolor: blue; - -.sapUiBody { - background-color: @mycolor; -} diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css deleted file mode 100644 index 654b3877e7c..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton-RTL.css +++ /dev/null @@ -1,3 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:var(--mycolor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton.css b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton.css deleted file mode 100644 index 654b3877e7c..00000000000 --- a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/resources/theme/library/e/themes/my_theme/library_skeleton.css +++ /dev/null @@ -1,3 +0,0 @@ -/*! - * Some fancy copyright - */.sapUiBody{background-color:var(--mycolor)} \ No newline at end of file diff --git a/packages/builder/test/expected/build/theme.library.e/dest-css-variables/test-resources/theme/library/e/Test.html b/packages/builder/test/expected/build/theme.library.e/dest-css-variables/test-resources/theme/library/e/Test.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/packages/builder/test/lib/builder/builder.js b/packages/builder/test/lib/builder/builder.js index cf0f0c0c46b..aadac619b73 100644 --- a/packages/builder/test/lib/builder/builder.js +++ b/packages/builder/test/lib/builder/builder.js @@ -38,7 +38,6 @@ const libraryOPath = path.join(__dirname, "..", "..", "fixtures", "library.o"); const libraryCore = path.join(__dirname, "..", "..", "fixtures", "sap.ui.core-evo"); const libraryCoreBuildtime = path.join(__dirname, "..", "..", "fixtures", "sap.ui.core-buildtime"); const themeJPath = path.join(__dirname, "..", "..", "fixtures", "theme.j"); -const themeLibraryEPath = path.join(__dirname, "..", "..", "fixtures", "theme.library.e"); const newLineRegexp = /\r?\n|\r/g; function clone(obj) { @@ -1206,96 +1205,6 @@ test.serial("Build library.coreBuildtime: replaceBuildtime", async (t) => { t.pass(); }); -test.serial("Build library with theme configured for CSS variables", async (t) => { - const destPath = "./test/tmp/build/theme.j/dest-css-variables"; - const expectedPath = "./test/expected/build/theme.j/dest-css-variables"; - - const graph = await graphFromObject({ - dependencyTree: themeJTree - }); - graph.setTaskRepository(taskRepository); - await graph.build({ - ui5DataDir: isolatedUi5DataDir(t), - destPath, - cssVariables: true, - }); - - const expectedFiles = await findFiles(expectedPath); - // Check for all directories and files - await directoryDeepEqual(t, destPath, expectedPath); - // Check for all file contents - await checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, destPath); - t.pass(); -}); - -test.serial("Build library with theme configured for CSS variables and theme designer resources", async (t) => { - const destPath = "./test/tmp/build/theme.j/dest-css-variables-theme-designer-resources"; - const expectedPath = "./test/expected/build/theme.j/dest-css-variables-theme-designer-resources"; - - const graph = await graphFromObject({ - dependencyTree: themeJTree - }); - graph.setTaskRepository(taskRepository); - await graph.build({ - ui5DataDir: isolatedUi5DataDir(t), - destPath, - cssVariables: true, - includedTasks: ["generateThemeDesignerResources"] - }); - - const expectedFiles = await findFiles(expectedPath); - // Check for all directories and files - await directoryDeepEqual(t, destPath, expectedPath); - // Check for all file contents - await checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, destPath); - t.pass(); -}); - -test.serial("Build theme-library with CSS variables", async (t) => { - const destPath = "./test/tmp/build/theme.library.e/dest-css-variables"; - const expectedPath = "./test/expected/build/theme.library.e/dest-css-variables"; - - const graph = await graphFromObject({ - dependencyTree: themeLibraryETree - }); - graph.setTaskRepository(taskRepository); - await graph.build({ - ui5DataDir: isolatedUi5DataDir(t), - destPath, - cssVariables: true - }); - - const expectedFiles = await findFiles(expectedPath); - // Check for all directories and files - await directoryDeepEqual(t, destPath, expectedPath); - // Check for all file contents - await checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, destPath); - t.pass(); -}); - -test.serial("Build theme-library with CSS variables and theme designer resources", async (t) => { - const destPath = "./test/tmp/build/theme.library.e/dest-css-variables-theme-designer-resources"; - const expectedPath = "./test/expected/build/theme.library.e/dest-css-variables-theme-designer-resources"; - - const graph = await graphFromObject({ - dependencyTree: themeLibraryETree - }); - graph.setTaskRepository(taskRepository); - await graph.build({ - ui5DataDir: isolatedUi5DataDir(t), - destPath, - cssVariables: true, - includedTasks: ["generateThemeDesignerResources"] - }); - - const expectedFiles = await findFiles(expectedPath); - // Check for all directories and files - await directoryDeepEqual(t, destPath, expectedPath); - // Check for all file contents - await checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, destPath); - t.pass(); -}); - test.serial("Build library.o with terminologies and supportedLocales", async (t) => { const destPath = path.join("test", "tmp", "build", "library.o", "dest"); const expectedPath = path.join("test", "expected", "build", "library.o", "dest"); @@ -2248,27 +2157,3 @@ const themeJTree = { } } }; - -const themeLibraryETree = { - // Using @openui5/ prefix to enable execution of generateThemeDesignerResources task - "id": "@openui5/theme.library.e.id", - "version": "1.0.0", - "path": themeLibraryEPath, - "dependencies": [], - "configuration": { - "specVersion": "2.0", - "type": "theme-library", - "metadata": { - "name": "theme.library.e", - "copyright": "Some fancy copyright" - }, - "resources": { - "configuration": { - "paths": { - "src": "src", - "test": "test" - } - } - } - } -}; diff --git a/packages/builder/test/lib/processors/themeBuilder.js b/packages/builder/test/lib/processors/themeBuilder.js index 5e5c2242145..bab131c6c70 100644 --- a/packages/builder/test/lib/processors/themeBuilder.js +++ b/packages/builder/test/lib/processors/themeBuilder.js @@ -37,7 +37,7 @@ async function prepareResources({library} = {}) { }; } -function getExpectedResults({compress, library, cssVariables}) { +function getExpectedResults({compress, library}) { const result = {}; if (compress) { result.css = @@ -82,36 +82,6 @@ function getExpectedResults({compress, library, cssVariables}) { `; } - if (cssVariables) { - result.cssVariablesSource = -`@someColor: #000000; - -:root { ---someColor: @someColor; -} -`; - result.cssVariables = -`:root { - --someColor: #000000; -} - -/* Inline theming parameters */ -#sap-ui-theme-sap\\.ui\\.foo{background-image:url('data:text/plain;utf-8,%7B%22someColor%22%3A%22%23000000%22%7D')} -`; - result.cssSkeleton = -`.someClass { - color: var(--someColor); - padding: 1px 2px 3px 4px; -} -`; - result.cssSkeletonRtl = -`.someClass { - color: var(--someColor); - padding: 1px 4px 3px 2px; -} -`; - } - return result; } @@ -243,51 +213,3 @@ test("ThemeBuilder: Builds a less file (no library)", async (t) => { t.is(await cssRtlResource.getString(), expected.cssRtl, "Right-to-left CSS should be correct"); t.is(await jsonResource.getString(), expected.json, "JSON should be correct"); }); - -test("Processor: Builds a less file (cssVariables = true)", async (t) => { - const {resource, memoryAdapter} = await prepareResources(); - - const [ - cssResource, - cssRtlResource, - jsonResource, - cssVariablesSourceResource, - cssVariablesResource, - cssSkeletonResource, - cssSkeletonRtlResource - ] = await themeBuilderProcessor({ - resources: [resource], - fs: fsInterface(memoryAdapter), - options: { - cssVariables: true - } - }); - - const expected = getExpectedResults({cssVariables: true}); - t.is(await cssResource.getString(), expected.css, "CSS should be correct"); - t.is(await cssRtlResource.getString(), expected.cssRtl, "Right-to-left CSS should be correct"); - t.is(await jsonResource.getString(), expected.json, "JSON should be correct"); - t.is(await cssVariablesSourceResource.getString(), expected.cssVariablesSource, - "CSS Variables source should be correct"); - t.is(await cssVariablesResource.getString(), expected.cssVariables, - "CSS Variables should be correct"); - t.is(await cssSkeletonResource.getString(), expected.cssSkeleton, - "Skeleton CSS should be correct"); - t.is(await cssSkeletonRtlResource.getString(), expected.cssSkeletonRtl, - "Right-to-left skeleton CSS should be correct"); - - t.is(cssResource.getPath(), "/resources/sap/ui/foo/themes/base/library.css", - "CSS resource path should be correct"); - t.is(cssRtlResource.getPath(), "/resources/sap/ui/foo/themes/base/library-RTL.css", - "Right-to-left CSS resource path should be correct"); - t.is(jsonResource.getPath(), "/resources/sap/ui/foo/themes/base/library-parameters.json", - "JSON resource path should be correct"); - t.is(cssVariablesSourceResource.getPath(), "/resources/sap/ui/foo/themes/base/css_variables.source.less", - "CSS Variables source path should be correct"); - t.is(cssVariablesResource.getPath(), "/resources/sap/ui/foo/themes/base/css_variables.css", - "CSS Variables resource path should be correct"); - t.is(cssSkeletonResource.getPath(), "/resources/sap/ui/foo/themes/base/library_skeleton.css", - "Skeleton CSS resource path should be correct"); - t.is(cssSkeletonRtlResource.getPath(), "/resources/sap/ui/foo/themes/base/library_skeleton-RTL.css", - "Right-to-left skeleton CSS resource path should be correct"); -}); diff --git a/packages/builder/test/lib/tasks/buildThemes.js b/packages/builder/test/lib/tasks/buildThemes.js index 2cf3de924c0..d737ac67dad 100644 --- a/packages/builder/test/lib/tasks/buildThemes.js +++ b/packages/builder/test/lib/tasks/buildThemes.js @@ -74,7 +74,6 @@ test.serial("buildThemes", async (t) => { fs: {}, options: { compress: true, // default - cssVariables: false // default } }, "Processor should be called with expected arguments"); @@ -129,7 +128,6 @@ test.serial("buildThemes (compress = false)", async (t) => { fs: {}, options: { compress: false, - cssVariables: false } }, "Processor should be called with expected arguments"); @@ -140,72 +138,6 @@ test.serial("buildThemes (compress = false)", async (t) => { t.true(workspace.write.calledWithExactly(jsonParametersResource)); }); -test.serial("buildThemes (cssVariables = true)", async (t) => { - t.plan(10); - - const lessResource = {}; - - const workspace = { - byGlob: async (globPattern) => { - if (globPattern === "/resources/test/library.source.less") { - return [lessResource]; - } else { - return []; - } - }, - write: sinon.stub() - }; - - const cssResource = {}; - const cssRtlResource = {}; - const jsonParametersResource = {}; - const cssVariablesSourceResource = {}; - const cssVariablesResource = {}; - const cssSkeletonResource = {}; - const cssSkeletonRtlResource = {}; - - t.context.themeBuilderStub.returns([ - cssResource, - cssRtlResource, - jsonParametersResource, - cssVariablesSourceResource, - cssVariablesResource, - cssSkeletonResource, - cssSkeletonRtlResource - ]); - - await buildThemes({ - workspace, - options: { - projectName: "sap.ui.demo.app", - inputPattern: "/resources/test/library.source.less", - cssVariables: true - } - }); - - t.is(t.context.themeBuilderStub.callCount, 1, - "Processor should be called once"); - - t.deepEqual(t.context.themeBuilderStub.getCall(0).args[0], { - resources: [lessResource], - fs: {}, - options: { - compress: true, - cssVariables: true - } - }, "Processor should be called with expected arguments"); - - t.is(workspace.write.callCount, 7, - "workspace.write should be called 7 times"); - t.true(workspace.write.calledWithExactly(cssResource)); - t.true(workspace.write.calledWithExactly(cssRtlResource)); - t.true(workspace.write.calledWithExactly(jsonParametersResource)); - t.true(workspace.write.calledWithExactly(cssVariablesSourceResource)); - t.true(workspace.write.calledWithExactly(cssVariablesResource)); - t.true(workspace.write.calledWithExactly(cssSkeletonResource)); - t.true(workspace.write.calledWithExactly(cssSkeletonRtlResource)); -}); - test.serial("buildThemes (filtering libraries)", async (t) => { t.plan(3); @@ -275,7 +207,6 @@ test.serial("buildThemes (filtering libraries)", async (t) => { fs: {}, options: { compress: true, - cssVariables: false } }, "Processor should be called with expected arguments"); @@ -354,7 +285,6 @@ test.serial("buildThemes (filtering themes)", async (t) => { fs: {}, options: { compress: true, - cssVariables: false } }, "Processor should be called with expected arguments"); @@ -477,7 +407,6 @@ test.serial("buildThemes (filtering libraries + themes)", async (t) => { fs: {}, options: { compress: true, - cssVariables: false } }, "Processor should be called with expected arguments"); diff --git a/packages/builder/test/lib/tasks/generateThemeDesignerResources.js b/packages/builder/test/lib/tasks/generateThemeDesignerResources.js index 5804b0db936..46a6f7a90a9 100644 --- a/packages/builder/test/lib/tasks/generateThemeDesignerResources.js +++ b/packages/builder/test/lib/tasks/generateThemeDesignerResources.js @@ -237,7 +237,6 @@ test.serial("generateThemeDesignerResources: Library sap.ui.core", async (t) => aFiles: [ "library", "global", - "css_variables" ] }, null, 2) }]); @@ -628,331 +627,6 @@ test.serial("generateThemeDesignerResources: Theme-Library", async (t) => { "workspace.write should be called with libraryLessResource"); }); -test.serial("generateThemeDesignerResources: Theme-Library with CSS Variables", async (t) => { - const {sinon, generateThemeDesignerResources, libraryLessGeneratorStub, ResourceStub} = t.context; - - const librarySourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/library.source.less") - }; - - const cssVariablesSourceResource = { - getString: sinon.stub().returns("My Content"), - }; - - const cssVariableSourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") - }; - - const workspace = { - byGlob: sinon.stub().callsFake(async (globPattern) => { - if (globPattern === "/resources/**/themes/*/library.source.less") { - return [librarySourceLessResource]; - } else if (globPattern === "/resources/**/themes/*/css_variables.source.less") { - return [cssVariableSourceLessResource]; - } else { - return []; - } - }), - byPath: sinon.stub().callsFake(async (virPath) => { - if (virPath === "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") { - return cssVariablesSourceResource; - } else { - return []; - } - }), - write: sinon.stub() - }; - const dependencies = {}; - - const libraryLessResource = {}; - - libraryLessGeneratorStub.resolves([libraryLessResource]); - - await generateThemeDesignerResources({ - workspace, - dependencies, - options: { - projectName: "sap.ui.demo.lib", - version: "1.2.3" - } - }); - - t.is(ResourceStub.callCount, 2); - t.true(ResourceStub.alwaysCalledWithNew()); - - t.deepEqual(ResourceStub.getCall(1).args, [{ - path: "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.less", - string: -`/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../base/css_variables.less"; - -/* START "css_variables.source.less" */ -My Content -/* END "css_variables.source.less" */ - -@import "../../../../../../sap/ui/core/themes/my_theme/global.less"; -` - }]); - const cssVariableResource = ResourceStub.getCall(1).returnValue; - - t.is(workspace.write.callCount, 3); - t.is(workspace.write.getCall(2).args.length, 1, - "workspace.write for cssVariableResource should be called with 1 argument"); - t.is(workspace.write.getCall(2).args[0], cssVariableResource, - "workspace.write should be called with cssVariableResource"); -}); - -test.serial("generateThemeDesignerResources: Theme-Library with CSS Variables with namespace", async (t) => { - const {sinon, generateThemeDesignerResources, libraryLessGeneratorStub, ResourceStub} = t.context; - - const librarySourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/library.source.less") - }; - - const cssVariablesSourceResource = { - getString: sinon.stub().returns("My Content from Namespace"), - }; - - const cssVariableSourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") - }; - - const workspace = { - byGlob: sinon.stub().callsFake(async (globPattern) => { - if (globPattern === "/resources/sap/ui/demo/lib/themes/*/library.source.less") { - return [librarySourceLessResource]; - } else if (globPattern === "/resources/sap/ui/demo/lib/themes/*/css_variables.source.less") { - return [cssVariableSourceLessResource]; - } else { - return []; - } - }), - byPath: sinon.stub().callsFake(async (virPath) => { - if (virPath === "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") { - return cssVariablesSourceResource; - } else { - return []; - } - }), - write: sinon.stub() - }; - const dependencies = {}; - - const libraryLessResource = {}; - - libraryLessGeneratorStub.resolves([libraryLessResource]); - - await generateThemeDesignerResources({ - workspace, - dependencies, - options: { - projectName: "sap.ui.demo.lib", - version: "1.2.3", - projectNamespace: "sap/ui/demo/lib" - } - }); - - t.is(t.context.ReaderCollectionPrioritizedStub.callCount, 1, "ReaderCollectionPrioritized should be created once"); - t.deepEqual(t.context.ReaderCollectionPrioritizedStub.getCall(0).args, [{ - name: `generateThemeDesignerResources - prioritize workspace over dependencies: sap.ui.demo.lib`, - readers: [workspace, dependencies] - }]); - - t.is(ResourceStub.callCount, 3); - t.true(ResourceStub.alwaysCalledWithNew()); - - t.deepEqual(ResourceStub.getCall(2).args, [{ - path: "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.less", - string: -`/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../base/css_variables.less"; - -/* START "css_variables.source.less" */ -My Content from Namespace -/* END "css_variables.source.less" */ - -@import "../../../../../../sap/ui/core/themes/my_theme/global.less"; -` - }]); - const cssVariableResource = ResourceStub.getCall(2).returnValue; - - t.is(workspace.write.callCount, 4); - t.is(workspace.write.getCall(3).args.length, 1, - "workspace.write for cssVariableResource should be called with 1 argument"); - t.is(workspace.write.getCall(3).args[0], cssVariableResource, - "workspace.write should be called with cssVariableResource"); -}); - -test.serial("generateThemeDesignerResources: Theme-Library with CSS Variables with base theme", async (t) => { - const { - sinon, - generateThemeDesignerResources, - libraryLessGeneratorStub, - ResourceStub, - ReaderCollectionPrioritizedStub - } = t.context; - - const librarySourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/library.source.less") - }; - - const cssVariablesSourceResource = { - getString: sinon.stub().returns("My Content with Base Theme"), - }; - - const cssVariableSourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") - }; - - const baseLessResource = {}; - - ReaderCollectionPrioritizedStub.returns({ - byPath: sinon.stub().callsFake(async (virPath) => { - if (virPath === "/resources/sap/ui/core/themes/my_theme/base.less") { - return baseLessResource; - } else { - return null; - } - }) - }); - - const workspace = { - byGlob: sinon.stub().callsFake(async (globPattern) => { - if (globPattern === "/resources/**/themes/*/library.source.less") { - return [librarySourceLessResource]; - } else if (globPattern === "/resources/**/themes/*/css_variables.source.less") { - return [cssVariableSourceLessResource]; - } else { - return []; - } - }), - byPath: sinon.stub().callsFake(async (virPath) => { - if (virPath === "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") { - return cssVariablesSourceResource; - } else { - return []; - } - }), - write: sinon.stub() - }; - const dependencies = {}; - - const libraryLessResource = {}; - - libraryLessGeneratorStub.resolves([libraryLessResource]); - - await generateThemeDesignerResources({ - workspace, - dependencies, - options: { - projectName: "sap.ui.demo.lib", - version: "1.2.3" - } - }); - - t.is(ResourceStub.callCount, 2); - t.true(ResourceStub.alwaysCalledWithNew()); - - t.deepEqual(ResourceStub.getCall(1).args, [{ - path: "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.less", - string: -`/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../base/css_variables.less"; - -/* START "css_variables.source.less" */ -My Content with Base Theme -/* END "css_variables.source.less" */ - -@import "../../../../../../../Base/baseLib/my_theme/base.less"; -@import "../../../../../../sap/ui/core/themes/my_theme/global.less"; -` - }]); - const cssVariableResource = ResourceStub.getCall(1).returnValue; - - t.is(workspace.write.callCount, 3); - t.is(workspace.write.getCall(2).args.length, 1, - "workspace.write for cssVariableResource should be called with 1 argument"); - t.is(workspace.write.getCall(2).args[0], cssVariableResource, - "workspace.write should be called with cssVariableResource"); -}); - -test.serial("generateThemeDesignerResources: Base Theme-Library with CSS Variables", async (t) => { - const { - sinon, - generateThemeDesignerResources, - libraryLessGeneratorStub, - ResourceStub - } = t.context; - - const librarySourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/base/library.source.less") - }; - - const cssVariablesSourceResource = { - getString: sinon.stub().returns("My Base Theme Content"), - }; - - const cssVariableSourceLessResource = { - getPath: sinon.stub().returns("/resources/sap/ui/demo/lib/themes/base/css_variables.source.less") - }; - - const workspace = { - byGlob: sinon.stub().callsFake(async (globPattern) => { - if (globPattern === "/resources/**/themes/*/library.source.less") { - return [librarySourceLessResource]; - } else if (globPattern === "/resources/**/themes/*/css_variables.source.less") { - return [cssVariableSourceLessResource]; - } else { - return []; - } - }), - byPath: sinon.stub().callsFake(async (virPath) => { - if (virPath === "/resources/sap/ui/demo/lib/themes/my_theme/css_variables.source.less") { - return cssVariablesSourceResource; - } else { - return []; - } - }), - write: sinon.stub() - }; - const dependencies = {}; - - const libraryLessResource = {}; - - libraryLessGeneratorStub.resolves([libraryLessResource]); - - await generateThemeDesignerResources({ - workspace, - dependencies, - options: { - projectName: "sap.ui.demo.lib", - version: "1.2.3" - } - }); - - t.is(ResourceStub.callCount, 2); - t.true(ResourceStub.alwaysCalledWithNew()); - - t.deepEqual(ResourceStub.getCall(1).args, [{ - path: "/resources/sap/ui/demo/lib/themes/base/css_variables.less", - string: -`/* NOTE: This file was generated as an optimized version of "css_variables.source.less" for the Theme Designer. */ - -@import "../../../../../../sap/ui/core/themes/base/global.less"; -` - }]); - const cssVariableResource = ResourceStub.getCall(1).returnValue; - - t.is(workspace.write.callCount, 3); - t.is(workspace.write.getCall(2).args.length, 1, - "workspace.write for cssVariableResource should be called with 1 argument"); - t.is(workspace.write.getCall(2).args[0], cssVariableResource, - "workspace.write should be called with cssVariableResource"); -}); - test.serial("generateThemeDesignerResources: .theming file missing in sap.ui.core library source`", async (t) => { const {sinon, generateThemeDesignerResources, libraryLessGeneratorStub, ResourceStub} = t.context; @@ -1003,7 +677,6 @@ test.serial("generateThemeDesignerResources: .theming file missing in sap.ui.cor aFiles: [ "library", "global", - "css_variables" ] }, null, 2) }]); diff --git a/packages/cli/lib/cli/commands/build.js b/packages/cli/lib/cli/commands/build.js index af7d82890c9..bd9c9d00c80 100644 --- a/packages/cli/lib/cli/commands/build.js +++ b/packages/cli/lib/cli/commands/build.js @@ -146,13 +146,6 @@ build.builder = function(cli) { defaultDescription: "Default", // Use "defaultDescription" to allow undefined (needed for evaluation) choices: ["Default", "Force", "Off"], }) - .option("experimental-css-variables", { - describe: - "Generate CSS variables (css-variables.css, css-variables.source.less)" + - " and skeleton (library-skeleton(-RTL).css) for all themes", - default: false, - type: "boolean" - }) .option("output-style", { describe: "Processes build results into a specific directory structure.
" + @@ -177,9 +170,7 @@ build.builder = function(cli) { "Build project but only apply the minify- and generateComponentPreload tasks") .example("ui5 build --include-task=minify --exclude-task=generateComponentPreload", "Build project by applying all default tasks including the minify " + - "task and excluding the generateComponentPreload task") - .example("ui5 build --experimental-css-variables", - "Preload build with experimental CSS variables artifacts"); + "task and excluding the generateComponentPreload task"); }; async function handleBuild(argv) { @@ -226,7 +217,6 @@ async function handleBuild(argv) { jsdoc: command === "jsdoc", includedTasks: argv["include-task"], excludedTasks: argv["exclude-task"], - cssVariables: argv["experimental-css-variables"], outputStyle: argv["output-style"], cache: argv["cache"], }); diff --git a/packages/cli/test/lib/cli/commands/build.js b/packages/cli/test/lib/cli/commands/build.js index 8234a6506bb..d439bde5cf7 100644 --- a/packages/cli/test/lib/cli/commands/build.js +++ b/packages/cli/test/lib/cli/commands/build.js @@ -23,8 +23,6 @@ function getDefaultArgv() { "clean-dest": false, "cache": "Default", "cleanDest": false, - "experimental-css-variables": false, - "experimentalCssVariables": false, "cache-mode": "Default", "cacheMode": "Default", "snapshot-cache": "Default", @@ -56,7 +54,6 @@ function getDefaultBuilderArgs() { jsdoc: false, includedTasks: undefined, excludedTasks: undefined, - cssVariables: false, outputStyle: "Default" }; } @@ -361,18 +358,6 @@ test.serial("ui5 build (Include dependency via configuration)", async (t) => { t.deepEqual(builder.getCall(0).args[0], expectedBuilderArgs, "default build triggered with expected arguments"); }); -test.serial("ui5 build --experimental-css-variables", async (t) => { - const {build, argv, builder, expectedBuilderArgs} = t.context; - - argv["experimental-css-variables"] = true; - - await build.handler(argv); - - expectedBuilderArgs.cssVariables = true; - t.deepEqual(builder.getCall(0).args[0], expectedBuilderArgs, - "Build with activated CSS Variables is called with expected arguments"); -}); - test.serial("ui5 build --output-style", async (t) => { const {build, argv, builder, expectedBuilderArgs} = t.context; diff --git a/packages/cli/test/lib/cli/commands/config.js b/packages/cli/test/lib/cli/commands/config.js index 73616ba81fe..b1773e2699d 100644 --- a/packages/cli/test/lib/cli/commands/config.js +++ b/packages/cli/test/lib/cli/commands/config.js @@ -31,8 +31,6 @@ function getDefaultArgv() { "dest": "./dist", "clean-dest": false, "cleanDest": false, - "experimental-css-variables": false, - "experimentalCssVariables": false, "$0": "ui5" }; } diff --git a/packages/project/lib/build/ProjectBuilder.js b/packages/project/lib/build/ProjectBuilder.js index 5966472866a..4d28d9ad0e6 100644 --- a/packages/project/lib/build/ProjectBuilder.js +++ b/packages/project/lib/build/ProjectBuilder.js @@ -22,7 +22,6 @@ class ProjectBuilder { * @public * @typedef {object} @ui5/project/build/ProjectBuilder~BuildConfiguration * @property {boolean} [selfContained=false] Flag to activate self contained build - * @property {boolean} [cssVariables=false] Flag to activate CSS variables generation * @property {boolean} [jsdoc=false] Flag to activate JSDoc build * @property {boolean} [createBuildManifest=false] * Whether to create a build manifest file for the root project. diff --git a/packages/project/lib/build/definitions/library.js b/packages/project/lib/build/definitions/library.js index 400be906f13..a01df0e856f 100644 --- a/packages/project/lib/build/definitions/library.js +++ b/packages/project/lib/build/definitions/library.js @@ -2,7 +2,7 @@ import {enhancePatternWithExcludes} from "./_utils.js"; import {enhanceBundlesWithDefaults} from "../../validation/validator.js"; /** - * Get tasks and their configuration for a given application project + * Get tasks and their configuration for a given library project * * @private * @param {object} parameters @@ -160,7 +160,6 @@ export default function({project, taskUtil, getTask}) { librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined, themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined, inputPattern: `/resources/${project.getNamespace()}/themes/*/library.source.less`, - cssVariables: taskUtil.getBuildOption("cssVariables") } }); diff --git a/packages/project/lib/build/definitions/module.js b/packages/project/lib/build/definitions/module.js index 0db873673dc..0d30535984a 100644 --- a/packages/project/lib/build/definitions/module.js +++ b/packages/project/lib/build/definitions/module.js @@ -1,5 +1,5 @@ /** - * Get tasks and their configuration for a given application project + * Get tasks and their configuration for a given module project * * @private * @param {object} parameters diff --git a/packages/project/lib/build/definitions/themeLibrary.js b/packages/project/lib/build/definitions/themeLibrary.js index 00ef7424290..debbaf67332 100644 --- a/packages/project/lib/build/definitions/themeLibrary.js +++ b/packages/project/lib/build/definitions/themeLibrary.js @@ -1,6 +1,6 @@ /** - * Get tasks and their configuration for a given application project + * Get tasks and their configuration for a given themeLibrary project * * @private * @param {object} parameters @@ -33,7 +33,6 @@ export default function({project, taskUtil, getTask}) { librariesPattern: !taskUtil.isRootProject() ? "/resources/**/(*.library|library.js)" : undefined, themesPattern: !taskUtil.isRootProject() ? "/resources/sap/ui/core/themes/*" : undefined, inputPattern: "/resources/**/themes/*/library.source.less", - cssVariables: taskUtil.getBuildOption("cssVariables") } }); diff --git a/packages/project/lib/build/helpers/BuildContext.js b/packages/project/lib/build/helpers/BuildContext.js index 59821282710..66ffc5e5b0d 100644 --- a/packages/project/lib/build/helpers/BuildContext.js +++ b/packages/project/lib/build/helpers/BuildContext.js @@ -17,7 +17,6 @@ class BuildContext { constructor(graph, taskRepository, { // buildConfig selfContained = false, - cssVariables = false, jsdoc = false, createBuildManifest = false, outputStyle = OutputStyleEnum.Default, @@ -69,7 +68,6 @@ class BuildContext { this._graph = graph; this._buildConfig = { selfContained, - cssVariables, jsdoc, createBuildManifest, outputStyle, @@ -83,9 +81,8 @@ class BuildContext { this._taskRepository = taskRepository; - this._options = { - cssVariables: cssVariables - }; + this._options = {}; + this._ui5DataDir = ui5DataDir; this._projectBuildContexts = new Map(); } diff --git a/packages/project/lib/graph/ProjectGraph.js b/packages/project/lib/graph/ProjectGraph.js index 653e6f7901b..200a3fa9c0a 100644 --- a/packages/project/lib/graph/ProjectGraph.js +++ b/packages/project/lib/graph/ProjectGraph.js @@ -705,7 +705,6 @@ class ProjectGraph { * Allows for a more sophisticated configuration for defining which dependencies should be * part of the build result. If this is provided, the other mentioned parameters will be ignored. * @param {boolean} [parameters.selfContained=false] Flag to activate self contained build - * @param {boolean} [parameters.cssVariables=false] Flag to activate CSS variables generation * @param {boolean} [parameters.jsdoc=false] Flag to activate JSDoc build * @param {boolean} [parameters.createBuildManifest=false] * Whether to create a build manifest file for the root project. @@ -726,7 +725,7 @@ class ProjectGraph { destPath, cleanDest = false, includedDependencies = [], excludedDependencies = [], dependencyIncludes, - selfContained = false, cssVariables = false, jsdoc = false, createBuildManifest = false, + selfContained = false, jsdoc = false, createBuildManifest = false, includedTasks = [], excludedTasks = [], outputStyle = OutputStyleEnum.Default, cache = Cache.Default, @@ -746,7 +745,7 @@ class ProjectGraph { graph: this, taskRepository: await this._getTaskRepository(), buildConfig: { - selfContained, cssVariables, jsdoc, + selfContained, jsdoc, createBuildManifest, includedTasks, excludedTasks, outputStyle, cache @@ -763,7 +762,7 @@ class ProjectGraph { async serve({ initialBuildRootProject = false, initialBuildIncludedDependencies = [], initialBuildExcludedDependencies = [], - selfContained = false, cssVariables = false, jsdoc = false, createBuildManifest = false, + selfContained = false, jsdoc = false, createBuildManifest = false, includedTasks = [], excludedTasks = [], cache = Cache.Default, ui5DataDir, @@ -782,7 +781,7 @@ class ProjectGraph { graph: this, taskRepository: await this._getTaskRepository(), buildConfig: { - selfContained, cssVariables, jsdoc, + selfContained, jsdoc, createBuildManifest, includedTasks, excludedTasks, outputStyle: OutputStyleEnum.Default, diff --git a/packages/project/test/lib/build/ProjectBuilder.js b/packages/project/test/lib/build/ProjectBuilder.js index fa86a635fa2..25d3d4fe614 100644 --- a/packages/project/test/lib/build/ProjectBuilder.js +++ b/packages/project/test/lib/build/ProjectBuilder.js @@ -642,7 +642,6 @@ test.serial("_writeResults: Create build manifest", async (t) => { t.deepEqual(createBuildManifestStub.getCall(0).args[1], { createBuildManifest: true, outputStyle: OutputStyleEnum.Default, - cssVariables: false, excludedTasks: [], includedTasks: [], jsdoc: false, diff --git a/packages/project/test/lib/build/definitions/library.js b/packages/project/test/lib/build/definitions/library.js index 1feb6c6f1d2..5f839d10b6e 100644 --- a/packages/project/test/lib/build/definitions/library.js +++ b/packages/project/test/lib/build/definitions/library.js @@ -118,7 +118,6 @@ test("Standard build", async (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: undefined } }, generateBundle: { @@ -160,10 +159,6 @@ test("Standard build", async (t) => { ], } }, "generateBundle task got called with correct arguments"); - - t.is(taskUtil.getBuildOption.callCount, 1, "taskUtil#getBuildOption got called once"); - t.is(taskUtil.getBuildOption.getCall(0).args[0], "cssVariables", - "taskUtil#getBuildOption got called with correct argument"); }); test("Standard build (framework project)", (t) => { @@ -260,7 +255,6 @@ test("Standard build with legacy spec version", (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: undefined } }, generateBundle: { @@ -399,7 +393,6 @@ test("Custom bundles", async (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: undefined } }, generateComponentPreload: { @@ -643,7 +636,6 @@ test("buildThemes: Project is not root", (t) => { librariesPattern: "/resources/**/(*.library|library.js)", themesPattern: "/resources/sap/ui/core/themes/*", inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: undefined } }, "Correct buildThemes task definition"); }); @@ -663,13 +655,8 @@ test("buildThemes: CSS Variables enabled", (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: true } }, "Correct buildThemes task definition"); - - t.is(taskUtil.getBuildOption.callCount, 1, "taskUtil#getBuildOption got called once"); - t.is(taskUtil.getBuildOption.getCall(0).args[0], "cssVariables", - "taskUtil#getBuildOption got called with correct argument"); }); test("Standard build: nulled taskFunction to skip tasks", (t) => { @@ -743,7 +730,6 @@ test("Standard build: nulled taskFunction to skip tasks", (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/project/b/themes/*/library.source.less", - cssVariables: undefined } }, generateBundle: { diff --git a/packages/project/test/lib/build/definitions/themeLibrary.js b/packages/project/test/lib/build/definitions/themeLibrary.js index 9d35d11a174..798bb49b1e9 100644 --- a/packages/project/test/lib/build/definitions/themeLibrary.js +++ b/packages/project/test/lib/build/definitions/themeLibrary.js @@ -70,7 +70,6 @@ test("Standard build", (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/**/themes/*/library.source.less", - cssVariables: undefined } }, generateResourcesJson: { @@ -81,9 +80,6 @@ test("Standard build", (t) => { } }, "Correct task definitions"); - t.is(taskUtil.getBuildOption.callCount, 1, "taskUtil#getBuildOption got called once"); - t.is(taskUtil.getBuildOption.getCall(0).args[0], "cssVariables", - "taskUtil#getBuildOption got called with correct argument"); t.is(generateThemeDesignerResourcesTaskFunction.taskFunction, null, "taskFunction is explicitly set to null"); }); @@ -133,7 +129,6 @@ test("Standard build for non root project", (t) => { librariesPattern: "/resources/**/(*.library|library.js)", themesPattern: "/resources/sap/ui/core/themes/*", inputPattern: "/resources/**/themes/*/library.source.less", - cssVariables: undefined } }, generateResourcesJson: { @@ -143,10 +138,6 @@ test("Standard build for non root project", (t) => { taskFunction: null } }, "Correct task definitions"); - - t.is(taskUtil.getBuildOption.callCount, 1, "taskUtil#getBuildOption got called once"); - t.is(taskUtil.getBuildOption.getCall(0).args[0], "cssVariables", - "taskUtil#getBuildOption got called with correct argument"); }); test("CSS variables enabled", (t) => { @@ -165,11 +156,6 @@ test("CSS variables enabled", (t) => { librariesPattern: undefined, themesPattern: undefined, inputPattern: "/resources/**/themes/*/library.source.less", - cssVariables: true } }, "Correct buildThemes task definition"); - - t.is(taskUtil.getBuildOption.callCount, 1, "taskUtil#getBuildOption got called once"); - t.is(taskUtil.getBuildOption.getCall(0).args[0], "cssVariables", - "taskUtil#getBuildOption got called with correct argument"); }); diff --git a/packages/project/test/lib/build/helpers/BuildContext.js b/packages/project/test/lib/build/helpers/BuildContext.js index 16832b98679..23c9338ac75 100644 --- a/packages/project/test/lib/build/helpers/BuildContext.js +++ b/packages/project/test/lib/build/helpers/BuildContext.js @@ -82,7 +82,6 @@ test("getBuildConfig: Default values", (t) => { t.deepEqual(buildContext.getBuildConfig(), { selfContained: false, outputStyle: OutputStyleEnum.Default, - cssVariables: false, jsdoc: false, createBuildManifest: false, includedTasks: [], @@ -103,7 +102,6 @@ test("getBuildConfig: Custom values", (t) => { }, "taskRepository", { selfContained: true, outputStyle: OutputStyleEnum.Namespace, - cssVariables: true, jsdoc: true, createBuildManifest: false, includedTasks: ["included tasks"], @@ -114,7 +112,6 @@ test("getBuildConfig: Custom values", (t) => { t.deepEqual(buildContext.getBuildConfig(), { selfContained: true, outputStyle: OutputStyleEnum.Namespace, - cssVariables: true, jsdoc: true, createBuildManifest: false, includedTasks: ["included tasks"], @@ -181,23 +178,6 @@ test("createBuildManifest not supported for self-contained build", (t) => { "Threw with expected error message"); }); -test("createBuildManifest supported for css-variables build", (t) => { - const {BuildContext} = t.context; - - t.notThrows(() => { - new BuildContext({ - getRoot: () => { - return { - getType: () => "library" - }; - } - }, "taskRepository", { - createBuildManifest: true, - cssVariables: true - }); - }); -}); - test("createBuildManifest supported for jsdoc build", (t) => { const {BuildContext} = t.context; @@ -297,12 +277,8 @@ test("getOption", (t) => { const graph = { getRoot: () => ({getType: () => "library"}), }; - const buildContext = new BuildContext(graph, "taskRepository", { - cssVariables: "value", - }); + const buildContext = new BuildContext(graph, "taskRepository", {}); - t.is(buildContext.getOption("cssVariables"), "value", - "Returned correct value for build configuration 'cssVariables'"); t.is(buildContext.getOption("selfContained"), undefined, "Returned undefined for build configuration 'selfContained' " + "(not exposed as build option)"); diff --git a/packages/server/test/lib/server/main.js b/packages/server/test/lib/server/main.js index 8e2e0849f0c..481fa501b62 100644 --- a/packages/server/test/lib/server/main.js +++ b/packages/server/test/lib/server/main.js @@ -18,12 +18,6 @@ test.before(async (t) => { cwd: "./test/fixtures/application.a" }); - // Wrap graph.serve to enable CSS Variables for theme tests - const originalServe = graph.serve.bind(graph); - graph.serve = function(options) { - return originalServe({...options, cssVariables: true}); - }; - server = await serve(graph, { port: 3333, ui5DataDir: isolatedUi5DataDir(t), @@ -314,68 +308,6 @@ async (t) => { }, "Correct response"); }); -test("Get css_variables.source.less (built by buildThemes task) " + - "(/resources/library/a/themes/base/css_variables.source.less)", -async (t) => { - const res = await request.get( - "/resources/library/a/themes/base/css_variables.source.less"); - if (res.error) { - throw new Error(res.error); - } - t.is(res.statusCode, 200, "Correct HTTP status code"); - t.regex(res.headers["content-type"], /less/, "Correct content type"); - t.is(res.text, `@libraryAColor1: #fafad2; - -:root { ---libraryAColor1: @libraryAColor1; -} -`, "Correct response"); -}); - -test("Get css_variables.css (built by buildThemes task) " + - "(/resources/library/a/themes/base/css_variables.css)", async (t) => { - const res = await request.get( - "/resources/library/a/themes/base/css_variables.css"); - if (res.error) { - throw new Error(res.error); - } - t.is(res.statusCode, 200, "Correct HTTP status code"); - t.regex(res.headers["content-type"], /css/, "Correct content type"); - // CSS is minified by default in buildThemes task - t.is(res.text, `:root{--libraryAColor1:#fafad2} -/* Inline theming parameters */ -#sap-ui-theme-library\\.a{background-image:url('data:text/plain;utf-8,%7B%22libraryAColor1%22%3A%22%23fafad2%22%7D')} -`, "Correct response"); -}); - -test("Get library_skeleton.css (built by buildThemes task) " + - "(/resources/library/a/themes/base/library_skeleton.css)", -async (t) => { - const res = await request.get( - "/resources/library/a/themes/base/library_skeleton.css"); - if (res.error) { - throw new Error(res.error); - } - t.is(res.statusCode, 200, "Correct HTTP status code"); - t.regex(res.headers["content-type"], /css/, "Correct content type"); - // CSS is minified by default in buildThemes task - t.is(res.text, `.library-a-foo{color:var(--libraryAColor1);padding:1px 2px 3px 4px}`, "Correct response"); -}); - -test("Get library_skeleton-RTL.css (built by buildThemes task) " + - "(/resources/library/a/themes/base/library_skeleton-RTL.css)", -async (t) => { - const res = await request.get( - "/resources/library/a/themes/base/library_skeleton-RTL.css"); - if (res.error) { - throw new Error(res.error); - } - t.is(res.statusCode, 200, "Correct HTTP status code"); - t.regex(res.headers["content-type"], /css/, "Correct content type"); - // CSS is minified by default in buildThemes task - t.is(res.text, `.library-a-foo{color:var(--libraryAColor1);padding:1px 4px 3px 2px}`, "Correct response"); -}); - test("Stop server", async (t) => { const port = 3351; const request = supertest(`http://localhost:${port}`);