GithubHelp home page GithubHelp logo

Usage with Webpack about rtlcss HOT 12 CLOSED

mohammadyounes avatar mohammadyounes commented on May 18, 2024 2
Usage with Webpack

from rtlcss.

Comments (12)

romainberger avatar romainberger commented on May 18, 2024 6

Hi, I've started a webpack plugin to produce a second bundle processed with rtlcss: https://github.com/romainberger/webpack-rtl-plugin (available on npm). It's meant to be used with the extract-text-webpack-plugin.

Hope this helps you, feedback appreciated!

from rtlcss.

romainberger avatar romainberger commented on May 18, 2024 4

Small update if people are still interested, I've made a rtl-css-loader for webpack to replace the basic css-loader so you can have rtl css with the style-loader. Can be useful if you're using the style-loader for dev.

from rtlcss.

ai avatar ai commented on May 18, 2024 2

OK. For example, you have two bundles: main.css and main.rtl.css.

Then, import main.css in main.rtl.css:

@import "../main.css";

And process *.rtl.css throw PostCSS with RTLCSS:

module.exports = {
    module: {
        loaders: [
            {
                test:   /\.rtl\.css$/,
                loader: "style-loader!css-loader!postcss-loader?pack=rtl"
            },
            {
                test:   /\.css$/,
                loader: "style-loader!css-loader!postcss-loader"
            }
        ]
    },
    postcss: function () {
        return {
            defaults: [autoprefixer, precss],
            rtl:  [rtlcss, autoprefixer, precss]
        };
    }
}

from rtlcss.

loick avatar loick commented on May 18, 2024 1

I have the exact same question actually but the answer of creating another rtl file is a bit weird actually. By using the extract-text-webpack-plugin, we should be able to generate the main.ltr.css file and the main.rtl.css file without even duplicating anything.

I will digg into it

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 18, 2024

I haven't used Webpack before! Did you consider https://github.com/postcss/postcss-loader ?

@ai Your input is highly appreciated!

from rtlcss.

ai avatar ai commented on May 18, 2024

But I am not really webpack user (for now, I prefer Browserify, because webpack API is ugly). So I can only show you a start point.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 18, 2024

Thanks @ai

from rtlcss.

kikoanis avatar kikoanis commented on May 18, 2024

Thanks. I get the idea except I feel that importing main.css within main.rtl is a bit redundant and I guess it is a work around webpack that will only generate one file per entry. I will try to play with this a little bit and see how it goes and report back here. thanks again both.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 18, 2024

Closing this as it's out of scope, but feel free to post here if you figure out a solution.

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 18, 2024

Cool ... Thanks!

from rtlcss.

MohammadYounes avatar MohammadYounes commented on May 18, 2024

Awesome 👍

from rtlcss.

Seb33300 avatar Seb33300 commented on May 18, 2024

Hello, anything new related to rtlcss usage with webpack?
Any easy way to do it without installing a third party plugin?

from rtlcss.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.