Skip to content

Commit d8ab630

Browse files
committed
fix: correct version in compiled css for published versions
closes #91
1 parent a93d343 commit d8ab630

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

nativescript-theme-core.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-theme-core",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Telerik NativeScript Core Theme",
55
"author": "Telerik <support@telerik.com>",
66
"homepage": "https://www.nativescript.org",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-theme-core",
3-
"version": "0.1.3",
3+
"version": "0.1.4",
44
"description": "Telerik NativeScript Core Theme",
55
"homepage": "https://www.nativescript.org",
66
"license": "Apache-2.0",

scripts/builder.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ function copySCSS() {
115115
*/
116116
function createCSSFromSCSS() {
117117

118+
var packageFile = './package.json';
119+
var packageJSON = {};
120+
121+
if (fs.existsSync(packageFile)) {
122+
packageJSON = require(packageFile);
123+
}
124+
var version = packageJSON ? packageJSON.version : null;
125+
118126
var sassFilesPath = './app/**/*.scss';
119127
var sassImportPaths = [
120128
'./app/',
@@ -134,7 +142,7 @@ function createCSSFromSCSS() {
134142
if (sassFiles[i].indexOf('/core.') === -1) {
135143
continue;
136144
}
137-
parseSass(sassFiles[i], sassImportPaths);
145+
parseSass(sassFiles[i], sassImportPaths, version);
138146
}
139147
}
140148

@@ -143,7 +151,7 @@ function createCSSFromSCSS() {
143151
* @param sassFile - File to load
144152
* @param importPaths - Other import paths
145153
*/
146-
function parseSass(sassFile, importPaths) {
154+
function parseSass(sassFile, importPaths, version) {
147155
var sassFileContent = fs.readFileSync(sassFile, { encoding: 'utf8'});
148156
var outputFile = 'nativescript-theme-core/css';
149157
var offset = sassFile.lastIndexOf('/');
@@ -156,6 +164,11 @@ function parseSass(sassFile, importPaths) {
156164
outFile: cssFilePath,
157165
outputStyle: 'compressed'
158166
});
167+
if (version) {
168+
// correct version tag
169+
var name = 'NativeScript Theme v';
170+
output.replace(name, name + version);
171+
}
159172
fs.writeFileSync(cssFilePath, output.css, 'utf8');
160173
}
161174

0 commit comments

Comments
 (0)