Skip to content
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

use npm-sass to find bin #3

Merged
merged 4 commits into from
Jan 6, 2017
Merged

use npm-sass to find bin #3

merged 4 commits into from
Jan 6, 2017

Conversation

JoeChapman
Copy link
Contributor

Use npm-sass to find install path of node-sass


// jscs:disable maximumLineLength
module.exports = {
'make-folders': `mkdir -p ${target}/js ${target}/css ${target}/images`,
'compile-css': `${sass} ${source}/scss/app.scss ${target}/css/app.css --include-path ./node_modules`,
'compile-css': `${npmsass} ${source}/scss/app.scss > ${target}/css/app.css`,
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem right. You're effectively toString-ing the module to get the string npm-sass. Just use the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, my bad

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, since this isn't an npm script, you'll need the fully qualified path to the binary, so I'd leave as it was with witch finding the binary path.


// jscs:disable maximumLineLength
module.exports = {
'make-folders': `mkdir -p ${target}/js ${target}/css ${target}/images`,
'compile-css': `${sass} ${source}/scss/app.scss ${target}/css/app.css --include-path ./node_modules`,
'compile-css': `${npmsass} ${source}/scss/app.scss > ${target}/css/app.css`,

Choose a reason for hiding this comment

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

What are you doing here? isn't npmsass the actual module? Are these my hands?

Choose a reason for hiding this comment

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

- update node-sass task to use npm-sass
@@ -4,12 +4,12 @@ const path = require('path');
const cwd = process.cwd();
const target = path.resolve(cwd, 'public');
const source = path.resolve(__dirname, '../src');
const sass = require('witch')('node-sass');
const npmsass = require('npm-sass');

Choose a reason for hiding this comment

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

do we need to include this at all?

Choose a reason for hiding this comment

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

we should either use npmsass programmatically or just use the name of the binary

Choose a reason for hiding this comment

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

personally, I would prefer all of this to be in just plain ol boring JS code, include the modules, use them, etcetera. But I know you love your dirty bash

Copy link
Contributor

Choose a reason for hiding this comment

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

o yeah I don't think you need this. I did it without it

Copy link
Contributor

Choose a reason for hiding this comment

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

personally, I would prefer all of this to be in just plain ol boring JS code

I'm inclined to agree, not least because there's absolutely zero error handling code in this setup at the moment. If things fail you get a nice console.error, but the process doesn't actually fail (i.e. exits with 0)

Copy link
Contributor

@sulthan-ahmed sulthan-ahmed left a comment

Choose a reason for hiding this comment

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

remove const npmsass = require('npm-sass');

@JoeChapman
Copy link
Contributor Author

@lennym @joefitter @sulthan-ahmed changes made

@joefitter
Copy link

actually @JoeChapman why are we eslintignoring bin? That dupe var would have been picked up if we linted it


// jscs:disable maximumLineLength
module.exports = {
'make-folders': `mkdir -p ${target}/js ${target}/css ${target}/images`,
'compile-css': `${sass} ${source}/scss/app.scss ${target}/css/app.css --include-path ./node_modules`,
'compile-css': `npmsass ${source}/scss/app.scss > ${target}/css/app.css`,
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to witch this, same as before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, there's an outside chance you might not need to, npm might work it out since you're inside the bin from package.json, but I'd want to check that first.

witch will be safe though.

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be ${npmsass}

@@ -4,12 +4,12 @@ const path = require('path');
const cwd = process.cwd();
const target = path.resolve(cwd, 'public');
const source = path.resolve(__dirname, '../src');
const sass = require('witch')('node-sass');
const npmsass = require('npm-sass');
Copy link
Contributor

Choose a reason for hiding this comment

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

personally, I would prefer all of this to be in just plain ol boring JS code

I'm inclined to agree, not least because there's absolutely zero error handling code in this setup at the moment. If things fail you get a nice console.error, but the process doesn't actually fail (i.e. exits with 0)

@JoeChapman
Copy link
Contributor Author

@joefitter will address the eslintignore stuff in separate pr

@joefitter
Copy link

joefitter commented Jan 6, 2017

personally, I would prefer all of this to be in just plain ol boring JS code

I'm inclined to agree, not least because there's absolutely zero error handling code in this setup at the moment. If things fail you get a nice console.error, but the process doesn't actually fail (i.e. exits with 0)

I'll raise an issue for this - unless you guys would prefer it to be addressed before merging?

@lennym
Copy link
Contributor

lennym commented Jan 6, 2017

@joefitter Makes sense.

No reason at all IMO to block merge - it's the same on master, it's just something that I spotted when I was reviewing/trying to work out what was going on.

@JoeChapman
Copy link
Contributor Author

JoeChapman commented Jan 6, 2017

@joefitter I'm not sure I follow, what is the context of that comment?
You would rather the eslint amends were made in this PR?
Or you want changes to the binary, i.e. proper error handling.. in this PR or another?

@joefitter
Copy link

joefitter commented Jan 6, 2017

@JoeChapman rather than doing:

"browserify": "browserify ./target ./output --plugin ./blah"

we would do:

var browserify = require('browserify');
var b = browserify();
b.add('./browser/main.js');
b.bundle().pipe(process.stdout);

@JoeChapman
Copy link
Contributor Author

ok, fair enough. However, I would prefer not to change all the things in this PR. Can you raise an issue so we can discuss...?
In the interim, I will fix the linting.
If this PR, minus those issues, is satisfactory please do me a solid

@joefitter
Copy link

@JoeChapman already did

@joefitter
Copy link

#4

@JoeChapman
Copy link
Contributor Author

I need one more +1 @lennym @sulthan-ahmed @easternbloc @gxxm

@easternbloc easternbloc merged commit 4959125 into master Jan 6, 2017
@easternbloc easternbloc deleted the fix/npm-sass branch January 6, 2017 12:30
@lennym
Copy link
Contributor

lennym commented Jan 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants