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

Commit

Permalink
(#14) fixing windows issues
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Wilkowski <Hi@Dominik-Wilkowski.com>
  • Loading branch information
dominikwilkowski committed May 4, 2017
1 parent e1d051c commit dfe80a8
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 8 deletions.
7 changes: 7 additions & 0 deletions packages/pancake-sass/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Pancake Sass plugin

## Versions

* [v1.1.0 - Optimized pancake for windows](v110)
* [v1.0.11 - Added a comment into the generated Sass files](v1011)
* [v1.0.10 - Fixed mixed js and Sass module bug](v1010)
* [v1.0.9 - Cleaned logs](v109)
Expand All @@ -20,6 +21,12 @@ Pancake Sass plugin
----------------------------------------------------------------------------------------------------------------------------------------------------------------


## v1.1.0

- Pancake now works on windows after escaping every path separator. Other operating system, other way to break code.
([#14](https://github.com/govau/pancake/issues/14))


## v1.0.11

- Added a comment into the generated Sass files.
Expand Down
1 change: 1 addition & 0 deletions packages/pancake-sass/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ To run the tests make sure you go to the monorepo this package came from and clo

## Release History

* v1.1.0 - Optimized pancake for windows
* v1.0.11 - Added a comment into the generated Sass files
* v1.0.10 - Fixed mixed js and Sass module bug
* v1.0.9 - Cleaned logs
Expand Down
2 changes: 1 addition & 1 deletion packages/pancake-sass/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gov.au/pancake-sass",
"version": "1.0.11",
"version": "1.1.0",
"description": "A Pancake plugin to compile sass files.",
"keywords": [
"npm",
Expand Down
4 changes: 2 additions & 2 deletions packages/pancake-sass/src/pancake.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const pancake = ( version, modules, settings, GlobalSettings, cwd ) => {
if( modulePackage.pancake['pancake-module'].sass['sass-versioning'] === true ) {
sassVersioning = true; //setting this if we encounter at least one module with sass-versioning enabled

const sassVersioningPath = Path.normalize(`${ cwd }/node_modules/sass-versioning/dist/_index.scss`);
const sassVersioningPath = Path.normalize(`${ cwd }/node_modules/sass-versioning/dist/_index.scss`).replace(/\\/g, "\\\\");

sass = `${ banner }` +
`/* ${ modulePackage.name } v${ modulePackage.version } */\n\n` +
Expand Down Expand Up @@ -195,7 +195,7 @@ export const pancake = ( version, modules, settings, GlobalSettings, cwd ) => {
const locationCSS = Path.normalize(`${ cwd }/${ SETTINGS.css.location }/${ SETTINGS.css.name }`);

if( sassVersioning === true ) {
const sassVersioningPath = Path.normalize(`${ cwd }/node_modules/sass-versioning/dist/_index.scss`);
const sassVersioningPath = Path.normalize(`${ cwd }/node_modules/sass-versioning/dist/_index.scss`).replace(/\\/g, "\\\\");

allSass = `${ banner }` +
`@import "${ sassVersioningPath }";\n\n` +
Expand Down
6 changes: 3 additions & 3 deletions packages/pancake-sass/src/sass.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const GenerateSass = ( location, name, modules, npmOrg ) => {
const modulePath = GetPath( name, modules, baseLocation, npmOrg )
sass += `@import "${ modulePath }";\n`;

return sass;
return sass.replace(/\\/g, "\\\\"); // escape path for silly windows
};


Expand All @@ -145,7 +145,7 @@ export const Sassify = ( location, settings, sass ) => {
data: sass,
indentType: 'tab', //this is how real developers indent!
outputStyle: settings.minified ? 'compressed' : 'expanded',
}, ( error, renered ) => {
}, ( error, generated ) => {
if( error ) {
Log.error(`Sass compile failed for ${ Style.yellow( location ) }`);

Expand All @@ -155,7 +155,7 @@ export const Sassify = ( location, settings, sass ) => {
Log.verbose(`Sass: Successfully compiled Sass for ${ Style.yellow( location ) }`);

Postcss([ Autoprefixer({ browsers: settings.browsers }) ])
.process( renered.css )
.process( generated.css )
.catch( error => reject( error ) )
.then( ( prefixed ) => {
if( prefixed ) {
Expand Down
7 changes: 7 additions & 0 deletions packages/pancake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Pancake

## Versions

* [v1.1.0 - Optimized pancake for windows](v110)
* [v1.0.15 - Fixed mixed js and Sass module bug](v1015)
* [v1.0.14 - Tweaked to facilitate syrup](v1013)
* [v1.0.13 - Loading animation](v1013)
Expand All @@ -22,6 +23,12 @@ Pancake
----------------------------------------------------------------------------------------------------------------------------------------------------------------


## v1.1.0

- Pancake now works on windows after escaping every path separator. Other operating system, other way to break code.
([#14](https://github.com/govau/pancake/issues/14))


## v1.0.15

- Fixed a bug where pancake would fail when we mix modules that are only Sass and only Js.
Expand Down
1 change: 1 addition & 0 deletions packages/pancake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ To run the tests make sure you go to the monorepo this package came from and clo

## Release History

* v1.1.0 - Optimized pancake for windows
* v1.0.15 - Fixed mixed js and Sass module bug
* v1.0.14 - Tweaked to facilitate syrup
* v1.0.13 - Loading animation
Expand Down
2 changes: 1 addition & 1 deletion packages/pancake/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gov.au/pancake",
"version": "1.0.15",
"version": "1.1.0",
"description": "Pancake is an utility to make working with npm modules for the frontend sweet and seamlessly.",
"keywords": [
"npm",
Expand Down
10 changes: 9 additions & 1 deletion packages/pancake/src/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,23 @@ export const CreateDir = ( dir ) => {
splitPath.reduce( ( path, subPath ) => {
let currentPath;

if( /^win/.test( process.platform ) && path === '' ) { // when using windows (post truth) at beginning of the path
path = './'; // we add the prefix to make sure it works on windows (yuck)
}

if( subPath != '.' ) {
currentPath = Path.normalize(`${ path }/${ subPath }`);

Log.verbose(`Checking if ${ Style.yellow( currentPath ) } exists`)

if( !Fs.existsSync( currentPath ) ){
try {
Fs.mkdirSync( currentPath );

Log.verbose(`Successfully ${ Style.yellow( currentPath ) } created`)
}
catch( error ) {
Log.error(`Pancake was unable to create the folder ${ Style.yellow( currentPath ) }`);
Log.error(`Pancake was unable to create the folder ${ Style.yellow( currentPath ) } for path ${ Style.yellow( dir ) }`);
Log.error( error );

process.exit( 1 );
Expand Down

0 comments on commit dfe80a8

Please sign in to comment.