gpt4 book ai didi

html - 带有 NPM 的 LESS CSS 无法在本地主机上工作并且无法在 Sublime 3 中安装 LESS Package Control

转载 作者:行者123 更新时间:2023-11-28 06:12:54 24 4
gpt4 key购买 nike

LESS 的 super 新手,不知道为什么我的样式没有显示。我以为前几天晚上我让它工作了,但看起来没有任何工作。

我确实尝试安装 LESS Package Control 但也失败了。我手动尝试并尝试将 PHP 代码复制到控制台中,但无济于事。不确定这是否会造成 LESS 困惑。

我也把Sublime右下角的选项改成了CSS,控制台报错。很抱歉在这方面有点乱,但我将不胜感激。

代码如下:

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>NPM Build System w/ Less</title>
<link rel="stylesheet/less" href="css/index.less">
</head>
<body>
<h1>Made with Love</h1>
<h2>Built with NPM</h2>
</body>
</html>

减少:

@baker-miller-pink: #FF91AF;
@nice-blue: #5B83AD;
@light-blue: @nice-blue + #111;

body {
background-color: @baker-miller-pink;
}

h1 {
color: @nice-blue;
}

Package.json:

{
"name": "npm-build-system",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"mkdir": "mkdir -p build",
"build": "npm run clean && npm run mkdir && npm run build:html && npm run build:css",
"watch": "npm run watch:html & npm run wathc:css",
"clean": "rm -rf build",
"build:html": "npm run clean:html && cp index.html build/",
"clean:html": "rm -f build/index.html",
"copy:index": "mv build/index.html ./",
"watch:html": "npm run build:html && chokidar index.html -c 'npm run build:html'",
"build:css" : "npm run clean:css && lessc --source-map css/index.less build/$npm_package_name.$npm_package_version.css",
"watch:css" : "npm run build:css && chokidar 'css/**/*.less' -c 'npm run build:css'",
"clean:css" : "rm -f build/$npm_package_name.$npm_package_version.css build/$npm_package_name.$npm_package_version.map",
},
"author": "",
"license": "ISC",
"devDependencies": {
"chokidar-cli": "^1.2.0",
"less": "^2.6.1"
}
}

最佳答案

你需要 Grunt 或 Gulp 来指定依赖关系,像这样:

less: {
development: {
options: {
compress: false,
optimization: 2,
sourceMap: true,
sourceMapFilename: './styles/style.css.map'
},
files: {
"app/styles/style.css": "app/styles/less/style.less"
}
},
}

关于html - 带有 NPM 的 LESS CSS 无法在本地主机上工作并且无法在 Sublime 3 中安装 LESS Package Control,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36052593/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com