无为

道常无为而无不为


  • 首页

  • 标签

  • 分类

  • 归档

  • 站点地图

  • 公益 404

  • 搜索

editorconfig

发表于 2018-08-07 | 分类于 editor | 阅读次数:
本文字数: 688 | 阅读时长 ≈ 1 分钟

使用editorconfig配置文件统一代码规范,vs code 默认不支持.editconfig文件,需要安装EditorConfig插件

安装EditorConfig插件

1
2
3
4
# 打开命令窗口
command + shift + p

# 搜索editorconfig

editorconfig配置

配置 值 描述
indent_style tab space Indentation Style
indent_size an integer tab Indentation Size (in single-spaced characters)
tab_width a positive integer (defaults indent_size when indent_size is a number) Width of a single tabstop character
end_of_line lf crlf cr Line ending file format (Unix, DOS, Mac)
charset utf-8 File character encoding
trim_trailing_whitespace true false Denotes whether whitespace is allowed at the end of lines
insert_final_newline true false Denotes whether file should end with a newline

postcss-stylelint

发表于 2018-08-04 | 分类于 css , postcss | 阅读次数:
本文字数: 843 | 阅读时长 ≈ 1 分钟

在webpack中使用stylelint规范css写法

在editor中安装stylelint

vscode安装stylelint插件

1
2
3
4
1、command + shift + p 打开命令窗口
2、输入Install Extensions
3、搜索 @sort:installs stylelint
# 安装stylelint插件

配置插件

设置user setting或者workspace setting,关闭系统对css的校验

1
2
3
"css.validate": false,
"less.validate": false,
"scss.validate": false

配置文件

1
2
3
4
5
6
7
# 安装配置规则
npm install stylelint-config-standard --save-dev

# 新建配置文件.stylelintrc
{
"extends": "stylelint-config-standard"
}

格式化文件

1
stylelint --fix

安装格式化插件

vscode安装 stylefmt

webpack集成stylelint

安装stylelint

1
npm install stylelint -D

修改postcss配置文件

1
2
3
4
5
6
7
8
9
module.exports = {
plugins: [
require('autoprefixer')({
browsers: ['last 5 versions']
}),
require('cssnano')({}),
require('stylelint')({})
]
}

postcss-cssnano

发表于 2018-08-03 | 分类于 css , postcss | 阅读次数:
本文字数: 323 | 阅读时长 ≈ 1 分钟

cssnano使用

在webpack中使用cssnano压缩css代码,首先需要安装postcss-loader

安装

1
npm i cssnano -D

配置

1
2
3
4
5
6
7
8
9
# postcss.config.js
module.exports = {
parser: 'sugarss',
plugins: {
'postcss-import': {},
'postcss-preset-env': {},
'cssnano': {}
}
}

jekyll编译静态页面

发表于 2018-07-26 | 分类于 jekyll | 阅读次数:
本文字数: 149 | 阅读时长 ≈ 1 分钟

使用jekyll编译github的gh-pages生成静态页面

安装jekyll

1
2
1. gem install bundler
2. bundler install

启动本地服务

1
bundle exec jekyll serve

生成静态页面

1
bundle exec jekyll build

nginx常用配置

发表于 2018-07-25 | 分类于 nginx | 阅读次数:
本文字数: 537 | 阅读时长 ≈ 1 分钟

nginx 教程

nginx伪静态规则

隐藏html文件后缀

1
2
3
4
5
6
7
# 文件不存在时访问.html文件
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /$1.html last;
break;
}
}

开启gzip

1
2
3
4
5
6
7
8
9
gzip on;
gzip_min_length 2k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/plain application/javascript application/x-javascript image/jpeg image/gif image/png text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";

docsify

发表于 2018-07-22 | 分类于 doc | 阅读次数:
本文字数: 28 | 阅读时长 ≈ 1 分钟

编写api文档工具介绍

docsify

gitbook

scp命令

发表于 2018-07-18 | 分类于 linux | 阅读次数:
本文字数: 85 | 阅读时长 ≈ 1 分钟

复制文件夹到远程服务器

1
scp -r ./dist root@47.104.230.189:/usr/local/apache4/htdocs/able-static/

eclipse打开npm依赖包卡死

发表于 2018-06-28 | 分类于 工具 , eclipse | 阅读次数:
本文字数: 255 | 阅读时长 ≈ 1 分钟

前端工程安装了很多npm的包,使用eclipse开发时导致eclipse经常卡死的解决办法:

  1. 把node_modules目录过滤掉
  2. 把node_modules从svn版本控制中忽略掉

过滤node_modules目录

右键单击工程,选择Properties->Resourse->Resource Filters,点击Add按钮添加要过滤的目录

svn忽略node_modules目录

右键单击工程,选择Term->设置属性

属性名选择svn:ignore,内容输入node_modules

git常用总结

发表于 2018-06-15 | 分类于 git | 阅读次数:
本文字数: 559 | 阅读时长 ≈ 1 分钟

配置

配置文件

配置文件有三个级别 仓库>全局>系统

  1. 仓库配置
    仓库级别配置文件在.git目录

查看仓库级别的配置

1
git config --local -l

  1. 全局配置
    全局配置文件在用户目录下,.gitconfig文件

查看全局配置项

1
git config --global -l

  1. 系统配置
    系统级别的配置在git的安装目录

记录用户名、密码

1
2
3
4
git config --global credential.helper store

# 修改用户名密码
git config --global credential.helper username

设置代理

1
2
git config --global http.proxy http://127.0.0.1:808
git config --global https.proxy https://127.0.0.1:808

删除配置

1
git config --unset xxx

拉取远程仓库分支

1
git pull <远程库名> <远程分支名>:<本地分支名>

问题处理

warning: http.proxy has multiple values

1
git config --unset-all http.proxy

拷贝.git目录

发表于 2018-06-15 | 阅读次数:
本文字数: 323 | 阅读时长 ≈ 1 分钟

有时候我们需要从远程仓库把代码下载到一个已经存在的目录,git clone的时候会报错,可以先把版本信息下载到一个空目录然后复制到当前目录,然后恢复到最新版本,这样当前目录就会包含版本信息。

1
2
3
4
5
#当前在workspace目录
git clone --no-checkout 远程仓库地址 tmp
mv tmp/.git ./
rm -rf tmp
git reset --hard HEAD

由于window、mac、linux系统的换行符不一样,导致mac系统下载下来的代码,git status的时候显示很多文件有修改,可以修改mac系统换行符的设置

1
git config --global core.autocrlf false
1234
xiaosl

xiaosl

不断尝试才能发现更好的

37 日志
26 分类
65 标签
RSS
GitHub Weibo 简书 Gitee
推荐
  • Web前端导航
  • 前端书籍资料
  • 百度前端技术学院
  • iissnan
© 2018 — 2020 xiaosl | 30k
京ICP备18021231号