nativescript-dev-sass
Advanced tools
Comparing version 0.4.2 to 1.0.0-rc.1
@@ -0,1 +1,5 @@ | ||
## v1.0.0-rc | ||
- Updated to support breaking changes in NativeScript 3.0; should be backwards compat with older NativeScript versions | ||
## v0.4.1 | ||
@@ -2,0 +6,0 @@ |
@@ -7,12 +7,24 @@ var fs = require('fs'); | ||
// Clean-up files from compiled app packages | ||
module.exports = function ($logger, $projectData, $usbLiveSyncService) { | ||
module.exports = function (logger, platformsData, projectData, hookArgs) { | ||
// delete all scss files from compiled sources | ||
var platformsData = $injector.resolve('platformsData'); | ||
return Promise.each(platformsData.platformsNames, function (platform) { | ||
// Don't include .SCSS files in LiveSync -- only sync CSS files | ||
if (hookArgs.filesToSync !== undefined) { | ||
hookArgs.filesToSync.forEach(function (file, index) { | ||
if (file.indexOf(".scss") !== -1) { | ||
// Remove the .SCSS file from LiveSync operation | ||
hookArgs.filesToSync.splice(index, 1); | ||
} | ||
}); | ||
} | ||
var platformData = platformsData.getPlatformData(hookArgs.platform.toLowerCase()); | ||
return new Promise(function(resolve, reject) { | ||
// Remove node_sass directory from compiled output | ||
var nodeSassPath = path.join(platformsData.getPlatformData(platform).appDestinationDirectoryPath, 'app/tns_modules/node-sass/'); | ||
var nodeSassPath = path.join(platformData.appDestinationDirectoryPath, 'app/tns_modules/node-sass/'); | ||
deleteFolderRecursive(nodeSassPath); | ||
// Find and remove unnecessary SCSS files from iOS and Android app packages | ||
var sassFilesPath = path.join(platformsData.getPlatformData(platform).appDestinationDirectoryPath, 'app/**/*.scss'); | ||
var sassFilesPath = path.join(platformData.appDestinationDirectoryPath, 'app/**/*.scss'); | ||
var sassFiles = glob.sync(sassFilesPath).filter(function (filePath) { | ||
@@ -24,4 +36,9 @@ var path = filePath; | ||
}); | ||
return Promise.each(sassFiles, function (sassFile) { | ||
Promise.each(sassFiles, function (sassFile) { | ||
return fs.unlinkSync(sassFile); | ||
}) | ||
.then(function() { | ||
console.log("All SASS source files removed from app package"); | ||
resolve(); | ||
}); | ||
@@ -44,2 +61,2 @@ }); | ||
} | ||
}; | ||
}; |
var converter = require('./converter'); | ||
module.exports = function ($logger, $projectData, $usbLiveSyncService) { | ||
return converter.convert($logger, $projectData.projectDir); | ||
module.exports = function (logger, platformsData, projectData, hookArgs) { | ||
// Do not run converter during LiveSync if there are no SCSS files being processed | ||
var runProcessor = false; | ||
if (hookArgs.filesToSync !== undefined) { | ||
hookArgs.filesToSync.forEach(function (file) { | ||
if (file.indexOf(".scss") !== -1) { | ||
runProcessor = true; | ||
} | ||
}); | ||
} else { | ||
// Not a LiveSync operation; always run converter | ||
runProcessor = true; | ||
} | ||
if (runProcessor) { | ||
console.log("Converting SCSS to CSS..."); | ||
return converter.convert(logger, projectData.projectDir); | ||
} | ||
} |
{ | ||
"name": "nativescript-dev-sass", | ||
"version": "0.4.2", | ||
"version": "1.0.0-rc.1", | ||
"description": "SASS CSS pre-processor for NativeScript projects.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -10,2 +10,4 @@ SASS CSS pre-processor for NativeScript projects | ||
**NOTE: LiveSync does not work with NativeScript CLI 2.5.x** | ||
This plugin will work in all version of NativeScript, but LiveSync only works with NativeScript 2.4.x and ealier, and again with 3.x+ | ||
@@ -12,0 +14,0 @@ How to use |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9606
147
33