Giter Site home page Giter Site logo

Comments (6)

w0330t avatar w0330t commented on July 23, 2024

我接着尝试,发现scss放在utils里面被编译成了wxss,

from miniprogram-template.

NewFuture avatar NewFuture commented on July 23, 2024

图标是使用image还是嵌入的背景图?
如果直接使用图片的话建个image的文件夹即可

assets 文件夹(可以配置)默认是放一些开发的时候用到,编译之后就没有的文件
比如公共的scss或者内联的背景图文件。

需要注意一下引用文件路径

from miniprogram-template.

NewFuture avatar NewFuture commented on July 23, 2024

编译报错可以贴一下代码和错误信息

from miniprogram-template.

w0330t avatar w0330t commented on July 23, 2024

我导入的文件是这个sass-rpx
因为用的webstorm而且scss一直都报rpx的错
然后报错如下


[23:43:31] 4wxss > app.scss → app.wxss
[23:43:31] 5json > app.jsonc → app.json
[23:43:31] 4wxss [×] Error
src\app.scss
Error: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
src\app.scss
Error: src\app.scss
Error: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
    at Object._newRenderError (Y:\clustered\node_modules\sass\sass.dart.js:10748:19)
    at Object._wrapException (Y:\clustered\node_modules\sass\sass.dart.js:10598:16)
    at _render_closure1.call$2 (Y:\clustered\node_modules\sass\sass.dart.js:33339:21)
    at _RootZone.runBinary$3$3 (Y:\clustered\node_modules\sass\sass.dart.js:19690:18)
    at _RootZone.runBinary$3 (Y:\clustered\node_modules\sass\sass.dart.js:19694:19)
    at _FutureListener.handleError$1 (Y:\clustered\node_modules\sass\sass.dart.js:18159:19)
    at _Future__propagateToListeners_handleError.call$0 (Y:\clustered\node_modules\sass\sass.dart.js:18447:40)
    at Object._Future__propagateToListeners (Y:\clustered\node_modules\sass\sass.dart.js:3484:88)
    at _Future._completeError$2 (Y:\clustered\node_modules\sass\sass.dart.js:18283:9)
    at _AsyncAwaitCompleter.completeError$2 (Y:\clustered\node_modules\sass\sass.dart.js:17682:12)
Error in plugin "sass"
Message:
    src\app.scss
Error: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
Details:
    formatted: Error: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
    line: 1
    column: 9
    file: Y:\clustered\src\app.scss
    status: 1
    messageFormatted: src\app.scss
Error: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
    messageOriginal: Can't find stylesheet to import.
  ╷
1 │ @import "/assets/rpx";
  │         ^^^^^^^^^^^^^
  ╵
  src\app.scss 1:9  root stylesheet
    relativePath: src\app.scss

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `mp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Blueness\AppData\Roaming\npm-cache\_logs\2019-09-21T15_43_31_279Z-debug.log

Process finished with exit code 1

这里是引用代码,我不调用这个,光引用就报错

@import "/assets/rpx";

text {
    font-size: 30rpx;
	color: #666;
}

page {
	background-color: #f5f5f5;
	min-height: 100%;
	display: flex;
	flex-direction: column;
}

@import "/assets/rpx";

text {
    font-size: 30rpx;
	color: #666;
}

page {
	background-color: #f5f5f5;
	min-height: 100%;
	display: flex;
	flex-direction: column;
}

我尝试把上面的_rpx.scss名字改为rpx.scss,也是不行的

from miniprogram-template.

NewFuture avatar NewFuture commented on July 23, 2024

scss 这个不支持绝对路径

@import "./assets/rpx";
// 或者
@import "rpx";

PS: 这个用VScode 装上插件 完全是另一种体验

如果需要支持 / 更目录引用 可以 在 https://github.com/NewFuture/miniprogram-build/issues 开一个讨论一下

from miniprogram-template.

w0330t avatar w0330t commented on July 23, 2024

好的谢谢,我试试vscode

from miniprogram-template.

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.