Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
037f2eb5
Commit
037f2eb5
authored
Oct 27, 2021
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused SASS bundling script
This has been replaced by `buildCSS` from @hypothesis/frontend-build.
parent
8e2d612c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
59 deletions
+0
-59
create-style-bundle.js
scripts/gulp/create-style-bundle.js
+0
-59
No files found.
scripts/gulp/create-style-bundle.js
deleted
100644 → 0
View file @
8e2d612c
'use strict'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
autoprefixer
=
require
(
'autoprefixer'
);
const
postcss
=
require
(
'postcss'
);
const
postcssURL
=
require
(
'postcss-url'
);
const
sass
=
require
(
'sass'
);
/**
* @typedef Options
* @prop {string} input - Input file path
* @prop {boolean} minify - Whether to minify the generated bundle
* @prop {string} output - Output file path
*/
/**
* Compile a SASS file and postprocess the result.
*
* @param {Options} options - Object specifying the input and output paths and
* whether to minify the result.
* @return {Promise} Promise for completion of the build.
*/
async
function
compileSass
({
input
,
minify
,
output
})
{
const
sourcemapPath
=
output
+
'.map'
;
let
result
=
sass
.
renderSync
({
file
:
input
,
includePaths
:
[
path
.
dirname
(
input
),
'node_modules'
],
outputStyle
:
minify
?
'compressed'
:
'expanded'
,
sourceMap
:
sourcemapPath
,
});
// Rewrite font URLs to look for fonts in 'build/fonts' instead of
// 'build/styles/fonts'
function
rewriteCSSURL
(
asset
)
{
return
asset
.
url
.
replace
(
/^fonts
\/
/
,
'../fonts/'
);
}
const
cssURLRewriter
=
postcssURL
({
url
:
rewriteCSSURL
,
});
const
postcssPlugins
=
[
autoprefixer
,
cssURLRewriter
];
result
=
await
postcss
(
postcssPlugins
).
process
(
result
.
css
,
{
from
:
output
,
to
:
output
,
map
:
{
inline
:
false
,
prev
:
result
.
map
.
toString
(),
},
});
fs
.
writeFileSync
(
output
,
result
.
css
);
fs
.
writeFileSync
(
sourcemapPath
,
result
.
map
.
toString
());
}
module
.
exports
=
compileSass
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment