Skip to content

Commit f842226

Browse files
committed
feat(dependencies): 2.0.0 and dropped deprecated sourcemap
1 parent 610027a commit f842226

File tree

7 files changed

+612
-60
lines changed

7 files changed

+612
-60
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
.vscode
3+
.idea

History.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.0.0 / 2022-10-28
2+
==================
3+
4+
* Switched from `css` to `@adobe/css-tools` which in turn drops deprecated sourceMap support
5+
* updated dependencies.
6+
17
1.0.1 / 2014-08-28
28
==================
39

Readme.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# rework [![Build Status](https://travis-ci.org/reworkcss/rework.png)](https://travis-ci.org/reworkcss/rework)
22

3+
> ### Forked Version using updated dependencies and dropped sourceMap support
4+
> Original repo at https://github.com/reworkcss/rework
5+
36
CSS manipulations built on [`css`](https://github.com/reworkcss/css), allowing
47
you to automate vendor prefixing, create your own properties, inline images,
58
anything you can imagine!
@@ -21,7 +24,7 @@ var pluginB = require('pluginB');
2124
rework('body { font-size: 12px; }', { source: 'source.css' })
2225
.use(pluginA)
2326
.use(pluginB)
24-
.toString({ sourcemap: true })
27+
.toString()
2528
```
2629

2730
## API
@@ -41,10 +44,6 @@ stylesheet root node and the `Rework` instance.
4144
Returns the string representation of the manipulated CSS. The `options` are
4245
passed directly to `css.stringify`.
4346

44-
Unlike `css.stringify`, if you pass `sourcemap: true` a string will still be
45-
returned, with the source map inlined. Also use `sourcemapAsObject: true` if
46-
you want the `css.stringify` return value.
47-
4847
## Plugins
4948

5049
Rework has a rich collection of plugins and mixins. Browse all the [Rework

index.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
* Module dependencies.
44
*/
55

6-
var css = require('css');
7-
var convertSourceMap = require('convert-source-map');
6+
var css = require('@adobe/css-tools');
87
var parse = css.parse;
98
var stringify = css.stringify;
109

@@ -62,21 +61,6 @@ Rework.prototype.use = function(fn){
6261
Rework.prototype.toString = function(options){
6362
options = options || {};
6463
var result = stringify(this.obj, options);
65-
if (options.sourcemap && !options.sourcemapAsObject) {
66-
result = result.code + '\n' + sourcemapToComment(result.map);
67-
}
6864
return result;
6965
};
7066

71-
/**
72-
* Convert sourcemap to base64-encoded comment
73-
*
74-
* @param {Object} map
75-
* @return {String}
76-
* @api private
77-
*/
78-
79-
function sourcemapToComment(map) {
80-
var content = convertSourceMap.fromObject(map).toBase64();
81-
return '/*# sourceMappingURL=data:application/json;base64,' + content + ' */';
82-
}

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
{
2-
"name": "rework",
3-
"version": "1.0.1",
2+
"name": "@fomantic/rework",
3+
"version": "2.0.0",
44
"description": "Plugin framework for CSS preprocessing",
55
"main": "index",
66
"files": [
77
"index.js"
88
],
99
"dependencies": {
10-
"css": "^2.0.0",
11-
"convert-source-map": "^0.3.3"
10+
"@adobe/css-tools": "^4.0.1"
1211
},
1312
"devDependencies": {
14-
"mocha": "^1.20.1",
15-
"should": "^4.0.4"
13+
"mocha": "^9.2.2",
14+
"should": "^13.2.3"
1615
},
1716
"scripts": {
1817
"test": "mocha --require should --reporter spec"
@@ -27,7 +26,7 @@
2726
"author": "TJ Holowaychuk <tj@vision-media.ca>",
2827
"repository": {
2928
"type": "git",
30-
"url": "git://github.com/reworkcss/rework.git"
29+
"url": "git://github.com/fomantic/rework.git"
3130
},
3231
"license": "MIT"
3332
}

test/rework.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,4 @@ describe('rework', function() {
2323
});
2424
});
2525

26-
describe('.toString() sourcemap option', function() {
27-
it('should inline sourcemap', function() {
28-
var result = rework('body { color: red; }').toString({
29-
compress: true,
30-
sourcemap: true
31-
});
32-
33-
result.should.equal(
34-
'body{color:red;}' + '\n' +
35-
'/*# sourceMappingURL=data:application/json;base64,' +
36-
'eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNvdXJjZS5jc3MiXSwibmFtZXMiOltdL' +
37-
'CJtYXBwaW5ncyI6IkFBQUEsS0FBTyIsInNvdXJjZXNDb250ZW50IjpbImJvZHkgey' +
38-
'Bjb2xvcjogcmVkOyB9Il19 */'
39-
);
40-
});
41-
});
42-
43-
describe('.toString() sourcemapAsObject and sourcemap options', function() {
44-
it('should return sourcemap as an object', function() {
45-
var result = rework('body { color: red; }').toString({
46-
compress: true,
47-
sourcemap: true,
48-
sourcemapAsObject: true
49-
});
50-
51-
result.code.should.equal('body{color:red;}');
52-
result.map.should.have.property('mappings');
53-
result.map.mappings.should.equal('AAAA,KAAO');
54-
});
55-
});
56-
5726
});

0 commit comments

Comments
 (0)