-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use "styleIncludePaths" ? #1073
Comments
styleIncludePaths doesn’t work as you are describing. Please take a look
https://github.com/ng-packagr/ng-packagr/blob/HEAD/docs/style-include-paths.md
…On Mon, 10 Sep 2018 at 04:15, Eusen ***@***.***> wrote:
Type of Issue
[?] Bug Report
Description
"styleIncludePaths": {
"description": "Any additional paths that should be used to resolve style imports",
"type": "array",
"items": {
"type": "string"
}
}
I found this schema, but no matter how I try, it doesn't work.
My lib dir structure is like this:
/lib/module/src/styles/index.scss
/lib/module/ng-package.json
And I add styleIncludePaths in ng-packge.json like this:
"lib": {
"entryFile": "src/public_api.ts",
"styleIncludePaths": [
"styles/index.scss" // and I have tried "index.scss" , "src/styles/index.scss", but nothing happened.
]
}
How To Reproduce
No error, but nothing happened.
Expected Behaviour
How do I use it?
If it doesn't work anyway, can u add a "staticAssetsPaths" schema, like
angular.json's architect.build.options.assets ?
I think more than me, many developers need to include static resources in
the package, such as font icons. I now use Python to do this.
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: latest
@angular/*: latest
typescript: 2.9.2
rxjs: latest
node: latest
npm/yarn: latest
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1073>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQv-Wi_eb9WdCfRgXwOfft_NQFSJbAzyks5uZcsugaJpZM4WgmGd>
.
|
hello? Is anyone here? |
You need to follow the angular cli schema for libraries. https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_ng_packagr/src/build/schema.json Those changes need to be added to |
The problem has not been solved yet. Why closed? |
If I write something wrong, can you point it out for me? |
I also encountered the same problem.... |
我想你没有理解stylePreprocessorOptions是什么,它就是一个帮助你省略路径的作用: |
谢谢你,我解决了,是在打包之后,又加了一个脚本把我的资源文件加入到dist里面 // scripts\build\copy-style.js
const path = require('path');
const fs = require('fs-extra');
const sourcePath = path.resolve(__dirname, '../../src/app/package');
const targetPath = path.resolve(__dirname, '../../dist');
console.log('---------------copy style folder-----------------------');
fs.copySync(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style'));
console.log('---------------done-----------------------'); package.json package后会执行 "postpackage": "node ./scripts/build/copy-style.js" |
脚本代码怎么写? |
// scripts\build\copy-style.js
const path = require('path');
const fs = require('fs-extra');
const sourcePath = path.resolve(__dirname, '../../src/app/package');
const targetPath = path.resolve(__dirname, '../../dist');
console.log('---------------copy style folder-----------------------');
fs.copySync(path.resolve(sourcePath, 'style'), path.resolve(targetPath, 'style'));
console.log('---------------done-----------------------'); package.json package后会执行 "postpackage": "node ./scripts/build/copy-style.js" |
不好意思,忘记说了,我使用了less,会有图片、字体资源。我希望构建的时候,我可以看到less的效果,拷贝的时候也可以拷贝less相应的css和图片、字体资源,有办法吗? |
@renyaoxiang 你这就有点强人所难了。本身这个工具就不支持这样做。 |
但是我需要这个需求啊, |
你可以用webpack打包试试,自己写个配置。或者rollup也行。 |
我这写的就是copy文件啊,你有啥想copy的就是写就行了 又不是只能写一个 |
@Eusen I have an example working using Have two libraries, style and component. Could integrate styles library with component library. The architect is something like this.
File ng-package.json By this, the component library will search at This worked for me! Let me know if you have an issue. |
Note that the path is relative to the library you're compiling - this is particularly relavent if you're using a nrwl monorepo structure! |
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem. |
Type of Issue
Description
I found this schema, but no matter how I try, it doesn't work.
My lib dir structure is like this:
And I add styleIncludePaths in ng-packge.json like this:
How To Reproduce
No error, but nothing happened.
Expected Behaviour
How do I use it?
If it doesn't work anyway, can u add a "staticAssetsPaths" schema, like angular.json's architect.build.options.assets ?
I think not only me, many developers need to include static resources in the package, such as font icons. I now use Python to do this.
Version Information
The text was updated successfully, but these errors were encountered: