This repository was archived by the owner on Aug 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Make Sass implementation agnostic ( supporting dart-sass ) #17
Open
fsubal
wants to merge
4
commits into
fetch:master
Choose a base branch
from
fsubal:feature/sass-implementation-agnostic
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,21 @@ | ||
| var fs = require('fs') | ||
| var path = require('path') | ||
| var sass = require('node-sass') | ||
| var assetFunctions = require('../') | ||
|
|
||
| var renderAsync = function(file, options, done) { | ||
| var renderAsync = function(sass, file, options, done) { | ||
| options = options || {} | ||
| options.images_path = __dirname + '/images' | ||
| options.fonts_path = __dirname + '/fonts' | ||
| options.implemantation = sass | ||
|
|
||
| return sass.render({ | ||
| functions: assetFunctions(options), | ||
| file: __dirname + '/scss/' + file | ||
| file: __dirname + '/scss/' + file, | ||
| }, done) | ||
| } | ||
|
|
||
| var equalsFileAsync = function(file, suite, options, done) { | ||
| renderAsync(file, options, function(err, result) { | ||
| var equalsFileAsync = function(sass, file, suite, options, done) { | ||
| renderAsync(sass, file, options, function(err, result) { | ||
| expect(err).toBeNull() | ||
| var cssPath = path.join(cssDir, suite, file.replace(/\.scss$/, '.css')) | ||
| fs.readFile(cssPath, function(err, expected) { | ||
|
|
@@ -44,42 +44,46 @@ var path_asset_cache_buster = function(http_path, real_path, done) { | |
| var extname = path.extname(http_path) | ||
| , basename = path.basename(http_path, extname) | ||
| , dirname = path.dirname(http_path) | ||
|
|
||
| done({path: path.join(dirname, basename + '-v123') + extname, query: null}) | ||
| }, 10) | ||
| } | ||
|
|
||
| var files = fs.readdirSync(sassDir) | ||
|
|
||
| describe('basic', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(file, 'basic', {}, done) | ||
| }) | ||
| }) | ||
| }) | ||
| describe.each(['node-sass', 'sass'])('with require("%s")', function(impl) { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently installed version of jest did not support
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for the record, the test failure was not due to the jest version ( it also failed with |
||
| var sass = require(impl) | ||
|
|
||
| describe('asset_host', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(file, 'asset_host', { asset_host: asset_host }, done) | ||
| describe('basic', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(sass, file, 'basic', {}, done) | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| describe('asset_cache_buster', function() { | ||
| describe('using query', function() { | ||
| describe('asset_host', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(file, 'asset_cache_buster/query', { asset_cache_buster: query_asset_cache_buster }, done) | ||
| equalsFileAsync(sass, file, 'asset_host', { asset_host: asset_host }, done) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| describe('using path', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(file, 'asset_cache_buster/path', { asset_cache_buster: path_asset_cache_buster }, done) | ||
| describe('asset_cache_buster', function() { | ||
| describe('using query', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(sass, file, 'asset_cache_buster/query', { asset_cache_buster: query_asset_cache_buster }, done) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
| describe('using path', function() { | ||
| files.forEach(function(file) { | ||
| test(file, function(done) { | ||
| equalsFileAsync(sass, file, 'asset_cache_buster/path', { asset_cache_buster: path_asset_cache_buster }, done) | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.