Skip to content

Remove scss files from complied sources #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2016
Merged
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
21 changes: 21 additions & 0 deletions lib/after-prepare.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var fs = require('fs');
var path = require('path');
var glob = require('glob');
var Promise = require('bluebird');

module.exports = function ($logger, $projectData, $usbLiveSyncService) {
// delete all scss files from compiled sources
var platformsData = $injector.resolve('platformsData');
return Promise.each(platformsData.platformsNames, function (platform) {
var sassFilesPath = path.join(platformsData.getPlatformData(platform).appDestinationDirectoryPath, 'app/**/*.scss');
var sassFiles = glob.sync(sassFilesPath).filter(function (filePath) {
var path = filePath;
var parts = path.split('/');
var filename = parts[parts.length - 1];
return path.indexOf("App_Resources") === -1 && filename.indexOf("_") !== 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@manojdcoder Any reason to leave prefixed files in the app packages? filename.indexOf("_")

What's the benefit? If none, probably makes sense to remove this check and just remove all .scss files outside of the App_Resources directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume this filter came from the converter.js file, where there is a need to explicitly filter-out SASS partials. I'll remove this one check and then merge.

});
return Promise.each(sassFiles, function (sassFile) {
return fs.unlinkSync(sassFile);
});
});
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-dev-sass",
"version": "0.3.0",
"version": "0.3.1",
"description": "SASS CSS pre-processor for NativeScript projects.",
"scripts": {
"test": "exit 0",
Expand All @@ -13,6 +13,11 @@
"type": "before-prepare",
"script": "lib/before-prepare.js",
"inject": true
},
{
"type": "after-prepare",
"script": "lib/after-prepare.js",
"inject": true
}
]
},
Expand All @@ -22,6 +27,7 @@
"url": "https://github.com/ToddAnglin/nativescript-dev-sass.git"
},
"dependencies": {
"bluebird": "^3.4.6",
"node-sass": "*",
"glob": "*",
"nativescript-hook": "^0.2.0"
Expand Down