Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Importing nested css is not transpired  #326

Closed
@amir20

Description

@amir20

Hello, I am new to PostCSS. I am getting a strange behavior with this module which I expect it to work. I have a simple project that looks like:

  • app.js
  • app.css
  • header.css

app.js

import "app.css"

app.css

@import "~normalize.css"
@import "./header.css"

header.css

header {
  & h1 { ... }
}

The issue is that header.css is never transpiled. I was using webpack2 at first but then I gave up and started using webpack1 and I still see the same problem.

Including header.css from app.js does work.

webpack.config.js

const webpack = require("webpack");
const path = require("path");
const ExtractTextPlugin = require('extract-text-webpack-plugin');


module.exports = {
    context: __dirname + "/themes/amirraminfar",
    entry: {
        app: "./static/js/app.js"
    },
    output: {
        path: __dirname + "/themes/amirraminfar/static/js/",
        filename: "[name].bundle.js",
    },
    resolve: {
        alias: {
            jquery: "jquery/src/jquery"
        }
    },
    module: {
        loaders: [{
            test: /\.js$/,
            exclude: /node_modules/,
            loader: 'babel-loader'
        }, {
            test: /\.css$/,
            loader: ExtractTextPlugin.extract('style-loader', 'css-loader', 'postcss-loader')
        }]
    },
    postcss: function(webpack) {
        return [
            require('postcss-import')({
                addDependencyTo: webpack
            }),
            require("postcss-cssnext")(),
            require('lost'),
            require('postcss-font-magician')()
        ]
    },
    plugins: [
        new ExtractTextPlugin("../css/[name].bundle.css"),
        new webpack.ProvidePlugin({
            $: "jquery",
            jQuery: "jquery",
            'window.jQuery': 'jquery'
        }),
    ]
};

What am I doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions