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

Add support for platform specific mainSheet #268

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion templates/webpack.angular.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { resolve, join } = require("path");
const fs = require('fs');

const webpack = require("webpack");
const nsWebpack = require("nativescript-dev-webpack");
Expand All @@ -12,11 +13,13 @@ const { AotPlugin } = require("@ngtools/webpack");

const ngToolsWebpackOptions = { tsConfigPath: "tsconfig.aot.json" };

const mainSheet = `app.css`;
let mainSheet = '';

module.exports = env => {
const platform = getPlatform(env);

mainSheet = getMainSheet(platform);

// Default destination inside platforms/<platform>/...
const path = resolve(nsWebpack.getAppPath(platform));

Expand Down Expand Up @@ -93,6 +96,12 @@ module.exports = env => {
};


function getMainSheet(platform) {
const mainSheet = `app.${platform}.css`;
return fs.existsSync(join(__dirname, 'app', mainSheet)) ?
mainSheet : 'app.css';
}

function getPlatform(env) {
return env.android ? "android" :
env.ios ? "ios" :
Expand Down
11 changes: 10 additions & 1 deletion templates/webpack.javascript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { resolve, join } = require("path");
const fs = require('fs');

const webpack = require("webpack");
const nsWebpack = require("nativescript-dev-webpack");
Expand All @@ -9,11 +10,13 @@ const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");


const mainSheet = `app.css`;
let mainSheet = '';

module.exports = env => {
const platform = getPlatform(env);

mainSheet = getMainSheet(platform);

// Default destination inside platforms/<platform>/...
const path = resolve(nsWebpack.getAppPath(platform));

Expand Down Expand Up @@ -90,6 +93,12 @@ module.exports = env => {
};


function getMainSheet(platform) {
const mainSheet = `app.${platform}.css`;
return fs.existsSync(join(__dirname, 'app', mainSheet)) ?
mainSheet : 'app.css';
}

function getPlatform(env) {
return env.android ? "android" :
env.ios ? "ios" :
Expand Down
11 changes: 10 additions & 1 deletion templates/webpack.typescript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { resolve, join } = require("path");
const fs = require('fs');

const webpack = require("webpack");
const nsWebpack = require("nativescript-dev-webpack");
Expand All @@ -9,11 +10,13 @@ const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");


const mainSheet = `app.css`;
let mainSheet = '';

module.exports = env => {
const platform = getPlatform(env);

mainSheet = getMainSheet(platform);

// Default destination inside platforms/<platform>/...
const path = resolve(nsWebpack.getAppPath(platform));

Expand Down Expand Up @@ -90,6 +93,12 @@ module.exports = env => {
};


function getMainSheet(platform) {
const mainSheet = `app.${platform}.css`;
return fs.existsSync(join(__dirname, 'app', mainSheet)) ?
mainSheet : 'app.css';
}

function getPlatform(env) {
return env.android ? "android" :
env.ios ? "ios" :
Expand Down