gulp scss starter
1.0.0
npm i -g yarnnpm i -g gulpnpm i -g bem-tools-coregit clone https://github.com/andreyalexeich/gulp-scss-starter.gitcd gulp-scss-starteryarn set version berryyarnyarn run dev (開發模式)yarn run build命令(彙編模式)如果您做的一切正確,則應使用本地服務器打開瀏覽器。彙編模式涉及項目的優化:圖像壓縮,CSS的縮小和JS文件以下載到服務器。
gulp-scss-starter
├── dist
├── gulp-tasks
├── src
│ ├── blocks
│ ├── fonts
│ ├── img
│ ├── js
│ ├── styles
│ ├── views
│ └── .htaccess
├── gulpfile.babel.js
├── webpack.config.js
├── package.json
├── .yarnrc.yml
├── .babelrc.js
├── .bemrc.js
├── .eslintrc.json
├── .stylelintrc
├── .stylelintignore
└── .gitignore
.babelrc.js預告片.bemrc.js -BEM設置.eslintrc.json -Eslint設置.gitignore禁止跟踪git文件.stylelintrc樣式設置.stylelintignore禁止跟踪Stylelint文件.yarnrc.yml設置紗線gulpfile.babel.js墨西哥灣設置webpack.config.js webpack設置package.json依賴列表src文件夾 - 開發過程中使用:src/blockssrc/fontssrc/imgsrc/jssrc/views/pagessrc/stylessrc/viewssrc/.htaccessdist文件夾yarn run dev一個文件夾gulp-tasks文件夾-A文件夾帶有GULP任務yarn run lint:styles - 檢查SCSS文件。對於VSCODE,您需要安裝插件。對於Webstorm或PhpStorm,您需要在Languages & Frameworks - Style Sheets - Stylelintyarn run dev - 啟動服務器以進行項目開發yarn run build - 通過優化收集一個項目,而無需啟動服務器yarn run build:views - 收集HTML文件yarn run build:styles - 編譯SCSS文件yarn run build:scripts - 收集JS失敗yarn run build:images - 收集圖像yarn run build:webp將圖像調整為.webp格式yarn run build:sprites - 收集芽菜yarn run build:fonts - 收集字體yarn run build:favicons收集Favikonkiyarn run build:gzip收集Apache配置yarn run bem-m -ADD BEM塊yarn run lint:styles --fix -fix -fix錯誤在SCSS文件中根據StyleLint設置yarn run lint:scripts - 檢查JS失敗yarn run lint:scripts --fix -fix -fix錯誤在JS文件中根據ESLINT設置src/blocks/modulessrc/views/index.html文件(或到所需的block將在哪裡調用的必要頁面文件)src/blocks/modules/_modules.scss文件src/js/import/modules.js中帶有BEM塊的文件夾結構的一個示例:
blocks
├── modules
│ ├──header
│ │ ├── header.html
│ │ ├── header.js
│ │ ├── header.scss
為了不手動創建相應的文件夾和文件,在控制台中規定以下命令是足夠的:在src/block/modules yarn run bem-m my-block在src/block/模塊中創建一個bem塊,其中my-block是bem塊的名稱(在創建之後,您需要刪除Bem Block文件的內容)。
src/views/pages文件夾中src/views/index.htmlsrc/fonts文件夾中.woff格式和.woff2src/styles/base/_fonts.scss文件src/img文件夾中.webp格式。此處使用的詳細信息src/img/favicon文件夾中,並且大小至少為1024px x 1024px要創建精靈.svg圖像應在src/img/sprites文件夾中。例如,我們有icon-1.svg , icon-2.svg和icon-3.svg文件,我們必須聯繫icon-2.svg 。為此,在HTML中,您需要使用標籤<use> :
< svg >
< use xlink:href =" img/sprites/sprite.svg#logo " > </ use >
</ svg >從CSS中的精靈更改SVG-ICON的樣式:
svg use {
fill : red;
}在某種程度上,如果無法更改圖標的樣式。這是由於以下事實:從無花果到SVG導出時,添加了額外的代碼。例如:
< svg width =" 18 " height =" 19 " viewBox =" 0 0 18 19 " fill =" none " xmlns =" http://www.w3.org/2000/svg " >
< path d =" M4.90918 4.04542L13.091 9.54088L4.90918 14.9545L4.90918 4.04542Z " fill =" #1B1B1D " />
</ svg >有必要刪除fill="none" ,然後fill="#1B1B1D" 。結果應該這樣:
< svg width =" 18 " height =" 19 " viewBox =" 0 0 18 19 " xmlns =" http://www.w3.org/2000/svg " >
< path d =" M4.90918 4.04542L13.091 9.54088L4.90918 14.9545L4.90918 4.04542Z " />
</ svg > node_modules文件夾中yarn add package_name命令(例如, yarn add jquery ) import $ from "jquery" ;src/styles/vendor/_libs.scss文件使用此組件。
告訴我有關蟲子,放星星,成為我啤酒的電報嗎?
對於所有問題,請用電報寫