import { loader } from 'webpack'; declare const enum ModulesType { local = "local", global = "global" } declare const enum CamelCase { Dashes = "dashes", Only = "only", DashesOnly = "dashesOnly" } /** * Allow to filter `url()`. All filtered `url()` will not be resolved (left in the code as they were written) * * @param url url string * @param resourcePath path to css file */ interface urlFunction { (url: string, resourcePath: string): string; } interface parsedImport { /** url of `@import` */ url: string; /** media query of `@import` */ media: string; } /** * Allow to filter `@import`. All filtered `@import` will not be resolved (left in the code as they were written) * * @param parsedImport parsedImport * @param resourcePath path to css file */ interface importFunction { (parsedImport: parsedImport, resourcePath: string): string; } export interface GetLocalIdentOptions { regExp: RegExp; hashPrefix: string; context: string; } /** * You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema. By default we use built-in function to generate a classname. * * @param context loader context * @param localIdentName localIdentName * @param localName localName * @param options get local identity options */ interface getLocalIdentFunction { (context: loader.LoaderContext, localIdentName: string, localName: string, options: Partial): string; } /** * css-loader options * * @see [css-loader](https://github.com/webpack-contrib/css-loader) */ export interface Options { /** * Enable/Disable `url()` handling * * Control `url()` resolving. Absolute URLs and root-relative URLs are not resolving. * * @default true * @example ``` url(image.png) => require('./image.png') url('image.png') => require('./image.png') url(./image.png) => require('./image.png') url('./image.png') => require('./image.png') url('http://dontwritehorriblecode.com/2112.png') => require('http://dontwritehorriblecode.com/2112.png') image-set(url('image2x.png') 1x, url('image1x.png') 2x) => require('./image1x.png') and require('./image2x.png') ``` To import assets from a `node_modules` path (include `resolve.modules`) and for `alias`, prefix it with a `~`: ``` url(~module/image.png) => require('module/image.png') url('~module/image.png') => require('module/image.png') url(~aliasDirectory/image.png) => require('otherDirectory/image.png') ``` * */ url: string | urlFunction; /** * Enable/Disable @import handling * * Control `@import` resolving. Absolute urls in `@import` will be moved in runtime code * * @default true * @example ``` @import 'style.css' => require('./style.css') @import url(style.css) => require('./style.css') @import url('style.css') => require('./style.css') @import './style.css' => require('./style.css') @import url(./style.css) => require('./style.css') @import url('./style.css') => require('./style.css') @import url('http://dontwritehorriblecode.com/style.css') => @import url('http://dontwritehorriblecode.com/style.css') in runtime ``` To import styles from a `node_modules` path (include `resolve.modules`) and for `alias`, prefix it with a `~`: ``` @import url(~module/style.css) => require('module/style.css') @import url('~module/style.css') => require('module/style.css') @import url(~aliasDirectory/style.css) => require('otherDirectory/style.css') ``` */ import: boolean | importFunction; /** * Enable/Disable CSS Modules and setup mode * * @default false * @description * The `modules` option enables/disables the **CSS Modules** spec and setup basic behaviour. * * | Name | Type | Description | * | :------------: | :---------: | :------------------------------------------------------------------------------------------------------------------------------- | * | **`true`** | `{Boolean}` | Enables local scoped CSS by default (use **local** mode by default) | * | **`false`** | `{Boolean}` | Disable the **CSS Modules** spec, all **CSS Modules** features (like `@value`, `:local`, `:global` and `composes`) will not work | * | **`'local'`** | `{String}` | Enables local scoped CSS by default (same as `true` value) | * | **`'global'`** | `{String}` | Enables global scoped CSS by default | * * Using `false` value increase performance because we avoid parsing **CSS Modules** features, it will be useful for developers who use vanilla css or use other technologies. * */ modules: boolean | ModulesType; /** * Configure the generated ident * You can configure the generated ident with the `localIdentName` query parameter. * * @default '[hash:base64]' * @see [loader-utils's documentation](https://github.com/webpack/loader-utils#interpolatename) for more information on options */ localIdentName: string; localIdentRegExp: string | RegExp; /** * Allow to redefine basic loader context for local ident name, By default we use `rootContext` of loader. */ context: string; /** * Allow to add custom hash to generate more unique classes */ hashPrefix: string; /** * Configure the function to generate classname based on a different schema * * You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema. * * By default we use built-in function to generate a classname. */ getLocalIdent: boolean | getLocalIdentFunction; /** * Enable/Disable Sourcemaps * * To include source maps set the `sourceMap` option. * * I.e. the `mini-css-extract-plugin` can handle them. * * They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS source maps do not). * In addition to that relative paths are buggy and you need to use an absolute public path which includes the server URL. * * @default false */ sourceMap: boolean; /** * Export Classnames in CamelCase * * @default false * @description * * By default, the exported JSON keys mirror the class names. If you want to camelize class names (useful in JS), pass the query parameter `camelCase` to css-loader * * | Name | Type | Description | * | :----------------: | :---------: | :----------------------------------------------------------------------------------------------------------------------- | * | **`false`** | `{Boolean}` | Class names will be camelized, the original class name will not to be removed from the locals | * | **`true`** | `{Boolean}` | Class names will be camelized | * | **`'dashes'`** | `{String}` | Only dashes in class names will be camelized | * | **`'only'`** | `{String}` | Introduced in `0.27.1`. Class names will be camelized, the original class name will be removed from the locals | * | **`'dashesOnly'`** | `{String}` | Introduced in `0.27.1`. Dashes in class names will be camelized, the original class name will be removed from the locals | */ camelCase: boolean | CamelCase; /** * Number of loaders applied before CSS loader * * The option `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@import`ed resources. * * @default 0 */ importLoaders: boolean | number; /** * Export only locals * * @default false * @description * Export only locals (**useful** when you use **css modules**). * * For pre-rendering with `mini-css-extract-plugin` you should use this option instead of `style-loader!css-loader` **in the pre-rendering bundle**. * * It doesn't embed CSS but only exports the identifier mappings. */ exportOnlyLocals: boolean; } export {}; //# sourceMappingURL=css-loader.d.ts.map