1
votes

I have been trying to incorporate bootstrap and fontawesome into my project, and all seems to be working well because, first of all the app.css file is empty.

After running gulp I received the following error:

Sass Compilation Failed: resources/assets/sass/app.scss Error: File to import not found or unreadable: /node_modules/bootstrap-sass/assets/stylesheets/bootstrap Parent style sheet: /home/vagrant/Code/Eventer/resources/assets/sass/app.scss on line 4 of resources/assets/sass/app.scss

@import '/node_modules/bootstrap-sass/assets/stylesheets/bootstrap';

This is how my gulp file is:

var elixir = require('laravel-elixir');

require('laravel-elixir-vueify');

var paths = { 
  'jquery': 'node_modules/jquery/', 
  'bootstrap': 'node_modules/bootstrap-sass/assets/', 
  'fontawesome': 'node_modules/font-awesome/'

};

elixir(function (mix) { 
   mix.sass('.scss', 'public/css/', {includePaths:   [paths.bootstrap +   'stylesheets', paths.fontawesome + 'scss']}) 
      .copy(paths.bootstrap + 'fonts/bootstrap/', 'public/fonts/bootstrap') 
      .copy(paths.fontawesome + 'fonts/', 'public/fonts/fontawesome') 
      .scripts([ 
         paths.jquery + "dist/jquery.js", 
         paths.bootstrap + "javascripts/bootstrap.js", 
       './resources/javascripts//.js', ], 
       'public/js/main.js', './') 
       .browserify('main.js') 
       .version([  
        'css/app.css', 
         'js/main.js'
       ]) 

});

This is my package.json file:

{ 
  "private": true, "scripts": { 
  "prod": "gulp --production", 
  "dev": "gulp  watch" }, 
  "devDependencies": { 
  "gulp": "^3.9.1", "laravel-elixir": "^5.0.0" },    
  "dependencies": { 
  "vue": "^1.0.26", 
  "vue-resource": "^0.9.3", 
  "laravel-elixir-vueify": "^1.0.3", 
  "stylus": "^0.54.5", "jquery": "^3.1.0", 
  "font-awesome": "^4.6.3", "bootstrap-sass": "^3.3.7"
 }
}

This is my app.scss file

@import "components/Alert"; 
$icon-font-path: 'node_modules/bootstrap- sass/assets/fonts/bootstrap'; 
$fa-font-path: 'node_modules/font-awesome/fonts';        
@import '/node_modules/bootstrap-sass/assets/stylesheets/bootstrap'; 
@import '/node_modules/font-awesome/scss';
1

1 Answers

1
votes

Essentially the app.scss file imports were wrong, the files couldn't be accessed but only by importing them directly like so:

@import "components/Alert";
$icon-font-path: '../../../vendor/bower_components/bootstrap-sass-official/assets/fonts';
$fa-font-path:   '../../../vendor/bower_components/fontawesome/fonts/';
@import '../../../vendor/bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap';
@import '../../../vendor/bower_components/fontawesome/scss/font-awesome';