Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid CSS error for sass-loader

My app.scss

.tes {
    color: red;
}

The output error when I execute ./node_modules/.bin/webpack

ERROR in ./~/css-loader!./~/sass-loader?indentedSyntax!./www/assets/app.scss
Module build failed: 
.tes {
     ^
      Invalid CSS after ".tes {": expected "}", was "{"
      in ./www/assets/app.scss (line 1, column 7)
 @ ./www/assets/app.scss 4:14-135 13:2-17:4 13:2-17:4 14:20-141

My webpack.config

 module: {
        loaders: [
            {
                test: /\.scss$/,
                loader: 'style!css!sass?indentedSyntax'
            },
            {
                test: /\.css$/,
                loader: 'style!css'
            }, {
                test: /\.(woff|woff2|ttf|eot|svg)(\?]?.*)?$/,
                loader: 'file-loader?name=res/[name].[ext]?[hash]'
            }
        ]
    },

And my app.js

require('./www/assets/app.scss');

var angular = require('angular');
var uiRouter = require('angular-ui-router');
require('velocity-animate');
require('node-lumx');

var HomeController = require('./www/components/home/homeController');

angular.module('app', ['lumx', uiRouter]) 
... //OMITED
like image 483
ridermansb Avatar asked Nov 02 '15 22:11

ridermansb


2 Answers

Try using sass loader without the option "indentedSyntax" as 'style!css!sass'

More info you can read the docs here: http://sass-lang.com/documentation/file.INDENTED_SYNTAX.html

like image 118
Hetmann W. Iohan Avatar answered Oct 28 '22 22:10

Hetmann W. Iohan


The solution would be to change your file extension to sass if you want to use sass syntax because as of version 3.2.0, sass-loader will derive the style you want to use from the file extension. It worked for me.

like image 30
ghsamm Avatar answered Oct 28 '22 22:10

ghsamm