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

How to use scss file with your gulp task #83

Open
ofirrifo opened this issue Feb 12, 2017 · 2 comments
Open

How to use scss file with your gulp task #83

ofirrifo opened this issue Feb 12, 2017 · 2 comments

Comments

@ofirrifo
Copy link

Hi,

Thanks for great gulp package.

How can I use this gulp package with scss files

Thanks

@aelbore
Copy link

aelbore commented Apr 16, 2017

#78 Can you take a look on this? if this solve your issue.

@aelbore
Copy link

aelbore commented Apr 16, 2017

const sass = require('node-sass');
const inlineNg2Template = require('gulp-inline-ng2-template');

const styleProcessor = (stylePath, ext, styleFile, callback) => {
  if (ext[0] === '.scss') {
    let sassObj = sass.renderSync({ file: stylePath });
    if (sassObj && sassObj['css']){
      styleFile = sassObj.css.toString('utf8');
    }
  }
  return callback(null, styleFile);  
};

const OPTIONS = {
  base: 'src', 
  useRelativePaths: true,
  styleProcessor: styleProcessor
}; 

const ng2InlineTemplate = () => {
  return inlineNg2Template(OPTIONS);
};

exports.ng2InlineTemplate = ng2InlineTemplate;

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

No branches or pull requests

2 participants