Skip to content

Commit 9a88035

Browse files
authored
refactor: introduce inline option (#147)
1 parent 7ef3808 commit 9a88035

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { convertLessError, getLessImports } from './less-utils';
77
export interface LoaderOptions {
88
/* Custom filter */
99
filter?: RegExp;
10+
/* Support importing less as string in typescript */
11+
inline?: boolean;
1012
}
1113

1214
/**
@@ -40,7 +42,9 @@ export function lessLoader(lessOptions: Less.Options = {}, loaderOptions: Loader
4042
const dir = path.dirname(args.path);
4143
const basename = path.basename(args.path);
4244
const isModule = basename.endsWith('.module.less');
43-
const loader: Loader = isModule ? 'local-css' : 'css';
45+
const loader: Loader = loaderOptions.inline === true
46+
? 'text'
47+
: (isModule ? 'local-css' : 'css');
4448

4549
const opts: Less.Options & { relativeUrls: boolean } = {
4650
filename: args.path,

0 commit comments

Comments
 (0)