0

I have set up a webapp using Sass with Yeoman's angular fullstack generator. It seemed to be running fine, until I realised errors that were being output every time grunt tries to run a task. Here's the output:

/Users/rorysmith/.rvm/rubies/ruby-2.2.1/bin/scss --no-cache --update app.scss:app.css
error app.scss (Line 4: File to import not found or unreadable: ../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap.)

Process finished with exit code 1

It's referring to a line in the app.scss file:

@import '../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap'

I changed the directory to include ../ at the start, as this is where my bower_components live:

folders

When commented out, it has an issue with a different line of the same file: @import 'modal/modal.scss';

Here's the app.scss file in its entirety, it's just the stock one created by the generator:

$icon-font-path: "../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap";
$fa-font-path: "../bower_components/font-awesome/fonts";

@import '../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap';
@import '../bower_components/font-awesome/fonts';

/**
 * App-wide Styles
 */

.browsehappy {
    margin: 0.2em 0;
    background: #ccc;
    color: #000;
    padding: 0.2em 0;
}

// Component styles are injected through grunt
// injector
@import 'account/login/login.scss';
@import 'admin/admin.scss';
@import 'create/create.scss';
@import 'main/main.scss';
@import 'modal/modal.scss';
// endinjector

Any idea what on earth is going on?

alanbuchanan
  • 3,993
  • 7
  • 41
  • 64

1 Answers1

0

I was encountering the same problem, here's what "fixed" it for me...

In the Gruntfile, find the following:

  // Inject component scss into app.scss
  sass: {
    options: {
      transform: function(filePath) {
        filePath = filePath.replace('/client/app/', '');
        filePath = filePath.replace('/client/components/', '');
        return '@import \'' + filePath + '\';';
      },
      starttag: '// injector',
      endtag: '// endinjector'
    },
    files: {
      '<%= yeoman.client %>/app/app.scss': [
        '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}',
        '!<%= yeoman.client %>/app/app.{scss,sass}'
      ]
    }
  },

Modify the following line to read:

filePath = filePath.replace('/client/components/', '../components/');

Now it should inject with the correct paths.

Caveat: I don't really know what I'm doing.

thewils
  • 21
  • 2