├── .eslintrc ├── .gitignore ├── .npmignore ├── .travis.yml ├── README.md ├── example ├── README.md ├── dist │ └── app.js ├── index.css ├── index.html ├── index.js ├── package.json ├── second.css └── webpack.config.js ├── index.js ├── lib ├── compile-exports.js ├── css-base.js ├── getImportPrefix.js ├── getLocalIdent.js ├── loader.js ├── localsLoader.js └── processCss.js ├── locals.js ├── package.json └── test ├── camelCaseTest.js ├── cssBaseTest.js ├── helpers.js ├── importTest.js ├── localTest.js ├── localsTest.js ├── moduleMinimizeTest.js ├── moduleMinimizeTestCases └── keyframes-and-animation │ ├── expected.css │ └── source.css ├── moduleTest.js ├── moduleTestCases ├── class-names │ ├── expected.css │ └── source.css ├── comments │ ├── expected.css │ └── source.css ├── keyframes-and-animation │ ├── expected.css │ └── source.css ├── leak-scope │ ├── expected.css │ └── source.css ├── simple │ ├── expected.css │ └── source.css ├── urls │ ├── expected.css │ └── source.css └── values │ ├── expected.css │ └── source.css ├── rtlTest.js ├── simpleTest.js ├── sourceMapTest.js ├── urlTest.js └── valuesTest.js /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true 4 | }, 5 | "rules": { 6 | "strict": 0, 7 | "curly": 0, 8 | "quotes": 0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | test 4 | example 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | - "node" 6 | - "iojs" 7 | 8 | notifications: 9 | email: false 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # (rtl) css loader for webpack [![Build Status](https://img.shields.io/travis/romainberger/rtl-css-loader/master.svg?style=flat-square)](https://travis-ci.org/romainberger/rtl-css-loader) 2 | 3 | Fork of the [css loader](https://github.com/webpack/css-loader), improved for rtl. 4 | 5 | Drop-in replacement of the css-loader, it simply checks the `dir` attribute on the `html` tag on the page, then injects either the regular css or the rtl'ized css. 6 | 7 | Uses [rtlcss](https://github.com/MohammadYounes/rtlcss) under the hood. 8 | 9 | **Warning** This module should only be used for development. The processing of your css being done server-side, the bundle will include both the regular css and the rtl version, which can make your bundle a lot bigger. If you're using the `extract-text-webpack-plugin`, check out the [webpack-rtl-plugin](https://github.com/romainberger/webpack-rtl-plugin). 10 | 11 | Check out the [webpack-rtl-example](https://github.com/romainberger/webpack-rtl-example) to see an example of an app using the rtl-css-loader and webpack-rtl-plugin. 12 | 13 | ## installation 14 | 15 | `npm install rtl-css-loader --save-dev` 16 | 17 | ## Usage 18 | 19 | Use it exactly like the [css-loader](https://github.com/webpack/css-loader): 20 | 21 | ``` javascript 22 | module.exports = { 23 | module: { 24 | loaders: [ 25 | { 26 | test: /\.css$/, 27 | loaders: ['style', 'rtl-css'] 28 | }, 29 | ] 30 | } 31 | }; 32 | ``` 33 | 34 | ## License 35 | 36 | [MIT](http://www.opensource.org/licenses/mit-license.php) 37 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # rtl-css-loader example 2 | 3 | # Usage 4 | 5 | ```shell 6 | # install the module dependencies 7 | cd .. 8 | npm install 9 | 10 | # install the example dependencies 11 | cd example 12 | npm install 13 | 14 | # run the webpack compilation 15 | npm run webpack 16 | 17 | # start the development server (uses python) 18 | npm start 19 | ``` 20 | 21 | Then open your browser at [http://localhost:3000](http://localhost:3000). 22 | 23 | To see how the module works, open `index.html` then change the `dir` attribute on the `html` tag. 24 | -------------------------------------------------------------------------------- /example/dist/app.js: -------------------------------------------------------------------------------- 1 | /******/ (function(modules) { // webpackBootstrap 2 | /******/ // The module cache 3 | /******/ var installedModules = {}; 4 | 5 | /******/ // The require function 6 | /******/ function __webpack_require__(moduleId) { 7 | 8 | /******/ // Check if module is in cache 9 | /******/ if(installedModules[moduleId]) 10 | /******/ return installedModules[moduleId].exports; 11 | 12 | /******/ // Create a new module (and put it into the cache) 13 | /******/ var module = installedModules[moduleId] = { 14 | /******/ exports: {}, 15 | /******/ id: moduleId, 16 | /******/ loaded: false 17 | /******/ }; 18 | 19 | /******/ // Execute the module function 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21 | 22 | /******/ // Flag the module as loaded 23 | /******/ module.loaded = true; 24 | 25 | /******/ // Return the exports of the module 26 | /******/ return module.exports; 27 | /******/ } 28 | 29 | 30 | /******/ // expose the modules object (__webpack_modules__) 31 | /******/ __webpack_require__.m = modules; 32 | 33 | /******/ // expose the module cache 34 | /******/ __webpack_require__.c = installedModules; 35 | 36 | /******/ // __webpack_public_path__ 37 | /******/ __webpack_require__.p = ""; 38 | 39 | /******/ // Load entry module and return exports 40 | /******/ return __webpack_require__(0); 41 | /******/ }) 42 | /************************************************************************/ 43 | /******/ ([ 44 | /* 0 */ 45 | /***/ function(module, exports, __webpack_require__) { 46 | 47 | __webpack_require__(1) 48 | console.log('Hey wassup') 49 | 50 | 51 | /***/ }, 52 | /* 1 */ 53 | /***/ function(module, exports, __webpack_require__) { 54 | 55 | // style-loader: Adds some css to the DOM by adding a