Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 2baebd9

Browse files
committed
feat: Configure the vendor scripts to also use less, sass, scss for app.css
This will make the apps able to use app.scss instead of app.css without additional manual reconfiguration.
1 parent 028089b commit 2baebd9

8 files changed

+7
-11
lines changed
File renamed without changes.
File renamed without changes.

Diff for: demo/TypeScriptApp/app/bundle-config.ts

-6
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ if ((<any>global).TNS_WEBPACK) {
66
// This will register each xml, css, js, ts, scss etc. in the app/ folder
77
const context = (<any>require).context("~/", true, /page\.(xml|css|js|ts|scss)$/);
88
global.registerWebpackModules(context);
9-
10-
console.log("Register:");
11-
context.keys().forEach(key => {
12-
console.log(" - " + key);
13-
});
14-
159
}

Diff for: templates/vendor.angular.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Snapshot the ~/app.css and the theme
22
const application = require("application");
33
require("ui/styling/style-scope");
4-
global.registerModule("app.css", () => require("~/app.css"));
4+
const appCssContext = require.context("~/", false, /^app\.(css|scss|less|sass)$/);
5+
global.registerWebpackModules(appCssContext);
56
application.loadAppCss();
67

78
require("./vendor-platform");

Diff for: templates/vendor.nativescript.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Snapshot the ~/app.css and the theme
22
const application = require("application");
33
require("ui/styling/style-scope");
4-
global.registerModule("app.css", () => require("~/app.css"));
4+
const appCssContext = require.context("~/", false, /^app\.(css|scss|less|sass)$/);
5+
global.registerWebpackModules(appCssContext);
56
application.loadAppCss();
67

78
require("./vendor-platform");

Diff for: templates/webpack.angular.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = env => {
6464
// Other CSS files get bundled using the raw loader
6565
{ test: /\.css$/, exclude: new RegExp(mainSheet), use: "raw-loader" },
6666
// SASS support
67-
{ test: /\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
67+
{ test: /\.scss$/, use: ["css-loader?url=false", "sass-loader"] },
6868
// Compile TypeScript files with ahead-of-time compiler.
6969
{ test: /.ts$/, loader: "@ngtools/webpack" },
7070
],

Diff for: templates/webpack.javascript.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = env => {
6262
// Other CSS files get bundled using the raw loader
6363
{ test: /\.css$/, exclude: new RegExp(mainSheet), use: "raw-loader" },
6464
// SASS support
65-
{ test: /\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
65+
{ test: /\.scss$/, use: ["css-loader?url=false", "sass-loader"] },
6666
]
6767
},
6868
plugins: [

Diff for: templates/webpack.typescript.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ module.exports = env => {
6262
// Other CSS files get bundled using the raw loader
6363
{ test: /\.css$/, exclude: new RegExp(mainSheet), use: "raw-loader" },
6464
// SASS support
65-
{ test: /\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
65+
{ test: /\.scss$/, use: ["css-loader?url=false", "sass-loader"] },
6666
// Compile TypeScript files, replace templateUrl and styleUrls.
6767
{ test: /\.ts$/, use: "awesome-typescript-loader" }
6868
]

0 commit comments

Comments
 (0)